/* ========================================
   ElektroSpektar Knjigovodstvo - Stilovi
   ======================================== */

:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
}

/* ========================================
   Login stranica
   ======================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('/static/images/background.jpg') no-repeat center center;
    background-size: cover;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo-icon {
    width: 60px;
    height: 60px;
}

.logo-icon-2 {
    width: 30px;
    height: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #333;
    margin: 10px 0 5px;
}

.login-header p {
    color: #666;
    margin: 0;
}

.login-card .form-control {
    padding: 12px 15px;
    border-radius: 8px;
}

.login-card .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.login-card .btn-primary {
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
    background: var(--primary-color);
    border: none;
    color: white;
}

.login-card .btn-primary:hover {
    background: var(--primary-dark);
}

/* ========================================
   Dashboard
   ======================================== */

.dashboard-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.sheet-tabs {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0 15px;
    flex-shrink: 0;
}

.sheet-tabs .nav-tabs {
    border-bottom: none;
}

.sheet-tabs .nav-link {
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 15px 20px;
    font-weight: 500;
    transition: all 0.2s;
}

.sheet-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: #ccc;
}

.sheet-tabs .nav-link.active {
    color: var(--primary-color);
    background: transparent;
    border-bottom-color: var(--primary-color);
}

.sheet-tabs .nav-link i {
    margin-right: 8px;
}

.tab-content {
    flex: 1;
    overflow: hidden;
}

.tab-pane {
    height: 100%;
}

.table-wrapper {
    height: 100%;
    overflow: auto;
    background: white;
}

/* ========================================
   Tabela
   ======================================== */

.table {
    margin: 0;
    font-size: 14px;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table th {
    background: #343a40;
    color: white;
    font-weight: 600;
    padding: 12px 15px;
    white-space: nowrap;
    border: 1px solid #454d55;
}

.table td {
    padding: 10px 15px;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table tbody tr:hover,
.table tbody tr:hover td {
    background-color: #e6f2ff !important;
    --bs-table-hover-bg: #e6f2ff;
    --bs-table-striped-bg: #e6f2ff;
    --bs-table-bg: #e6f2ff;
}

.row-number {
    background: #f1f3f4 !important;
    color: #666;
    font-weight: 500;
    text-align: center;
    width: 50px;
    min-width: 50px;
}

.table thead .row-number {
    background: #495057 !important;
    color: white;
}

/* ========================================
   Editable KOMENTAR cells
   ======================================== */

.komentar-cell {
    cursor: text;
    min-width: 150px;
    max-width: 400px;
    white-space: pre-wrap !important;
    transition: background-color 0.3s;
    border-left: 2px solid #99ccff !important;
    border-right: 2px solid #99ccff !important;
}

.komentar-cell:focus {
    outline: 2px solid #99ccff;
    outline-offset: -2px;
    background-color: #fff9c4 !important;
}

.komentar-cell:hover {
    background-color: #f0f7ff !important;
}

.log-cell {
    min-width: 120px;
    font-size: 12px;
    color: #666;
    white-space: pre-line !important;
}

/* ========================================
   Toast notifikacija
   ======================================== */

.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   Notify toast notifikacije
   ======================================== */

.notify-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.notify-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
}

.notify-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.notify-toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

.notify-success {
    background: #198754;
}

.notify-error {
    background: #dc3545;
}

.notify-info {
    background: var(--primary-color);
}

/* ========================================
   Navbar
   ======================================== */

.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 600;
    font-size: 20px;
}

.navbar-brand i {
    margin-right: 8px;
}

/* Mobilni korisnik - sakriven na desktopu */
.nav-user-mobile {
    display: none;
}

/* ========================================
   Responzivnost - SAMO za mobilni (<992px)
   Desktop ostaje potpuno nepromenjen
   ======================================== */

@media (max-width: 991.98px) {
    /* Navbar - dva reda: logo+korisnik | dugmad u jednom redu */
    .navbar .container-fluid {
        flex-wrap: wrap;
    }

    .navbar-brand {
        font-size: 16px;
    }

    .nav-user-mobile {
        display: inline !important;
        font-size: 13px;
    }

    .nav-buttons .nav-user {
        display: none;
    }

    .nav-buttons {
        flex-direction: row !important;
        width: 100%;
        justify-content: center;
        padding: 6px 0 2px;
        gap: 4px !important;
        flex-wrap: nowrap;
    }

    .nav-buttons .btn {
        font-size: 12px;
        padding: 4px 8px;
        white-space: nowrap;
    }

    /* Sheet tabs - horizontalni scroll */
    .sheet-tabs {
        padding: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .sheet-tabs .nav-tabs {
        flex-wrap: nowrap;
        white-space: nowrap;
        min-width: max-content;
    }

    .sheet-tabs .nav-link {
        padding: 10px 14px;
        font-size: 13px;
    }

    .sheet-tabs .nav-link i {
        display: none;
    }

    /* Dashboard visina */
    .dashboard-container {
        height: calc(100vh - 56px);
    }

    /* Tabela */
    .table {
        font-size: 12px;
    }

    .table th {
        padding: 8px 10px;
        font-size: 11px;
    }

    .table td {
        padding: 6px 8px;
        max-width: 200px;
    }

    .row-number {
        width: 35px;
        min-width: 35px;
    }

    .komentar-cell {
        min-width: 120px;
        max-width: 250px;
    }

    .log-cell {
        min-width: 90px;
        font-size: 10px;
    }

    /* Toast notifikacije */
    .notify-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .notify-toast {
        padding: 10px 15px;
        font-size: 14px;
    }

    .toast-notification {
        bottom: 10px;
        right: 10px;
    }

    /* Logout popup */
    .logout-popup {
        padding: 20px 25px;
        margin: 20px;
    }

    .logout-popup p {
        font-size: 16px;
    }

    .corner-logo.small {
        display: none;
    }

    .login-card {
        padding: 30px 20px;
    }
}

/* ========================================
   Scrollbar stilovi
   ======================================== */

.table-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    border-radius: 8px;
    border: none;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

.alert code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ========================================
   Admin Panel - Upravljanje korisnicima
   ======================================== */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px 12px 0 0 !important;
}

.card-header h5 {
    font-weight: 600;
    color: #333;
}

.card-header h5 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.card-body {
    padding: 20px;
}

.badge {
    padding: 6px 12px;
    font-weight: 500;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-warning {
    color: #000;
}

.modal-content {
    border: none;
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
}

.modal-title i {
    margin-right: 10px;
}

.form-label {
    font-weight: 500;
    color: #555;
    font-weight: bold;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

/* ========================================
   Logo - donji desni ugao
   ======================================== */

.corner-logo {
    position: fixed;
    bottom: 5px;
    right: 5px;
    z-index: 100;
}

.corner-logo img {
    max-width: 40px;
    height: auto;
}

.corner-logo.small img {
    max-width: 40px;
    opacity: 0.65;
}

.corner-logo.login-logo img {
    max-width: 40px;
    opacity: 1;
}

.razvoj {
    position: fixed;
    bottom: 5px; /* Udaljenost od dna */
    z-index: 1000; /* Da biste osigurali da je logo iznad drugih elemenata */
    color: black;
    font-size: 10px;
    text-align: center; /* Centriranje teksta unutar elementa */
}

@media (max-width: 768px) {
    .razvoj {
        bottom: 5px; /* Udaljenost od dna */
        z-index: 1000; /* Da biste osigurali da je logo iznad drugih elemenata */
        color: black;
        font-weight: normal;
        text-align: center;
    }
}

/* ========================================
   Logout confirm popup
   ======================================== */

.logout-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.logout-overlay.show {
    display: flex;
}

.logout-popup {
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    animation: popupIn 0.2s ease;
}

@keyframes popupIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.logout-popup p {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 25px 0;
}

.logout-popup .popup-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.logout-popup .popup-buttons .btn {
    min-width: 100px;
    font-weight: 600;
    font-size: 18px;
}
