* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f5f7;
    color: #20252b;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}


/* =========================
   UTILITIES
========================= */

.hidden {
    display: none !important;
}

.error {
    margin-top: 10px;
    color: #c62828;
    font-size: 14px;
}


/* =========================
   LOGIN
========================= */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef1f4;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.logo {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 3px;
}

.subtitle {
    text-align: center;
    margin-top: 8px;
    margin-bottom: 30px;
    color: #6b7280;
}


/* =========================
   FORMS
========================= */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea,
.filters input,
.filters select {
    width: 100%;
    border: 1px solid #ccd2d8;
    border-radius: 7px;
    padding: 10px 12px;
    background: #ffffff;
    color: #20252b;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.filters input:focus,
.filters select:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.12);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #777;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}


/* =========================
   LOGIN BUTTON
========================= */

.login-button {
    width: 100%;
    border: 0;
    border-radius: 7px;
    padding: 12px;
    background: #1976d2;
    color: white;
    font-weight: 600;
}

.login-button:hover {
    background: #1565c0;
}


/* =========================
   TOP BAR
========================= */

.topbar {
    height: 64px;
    background: #1f2933;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
}

.topbar-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-user span {
    font-size: 14px;
}

#logout-button {
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    border-radius: 6px;
    padding: 7px 12px;
}

#logout-button:hover {
    background: rgba(255, 255, 255, 0.1);
}


/* =========================
   MAIN
========================= */

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.main-content h1 {
    margin-top: 0;
    margin-bottom: 25px;
}


/* =========================
   NAVIGATION
========================= */

.navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    border-bottom: 1px solid #d7dce1;
}

.nav-button {
    border: 0;
    background: transparent;
    padding: 12px 18px;
    color: #5f6872;
    border-bottom: 3px solid transparent;
    font-weight: 600;
}

.nav-button:hover {
    color: #1976d2;
}

.nav-button.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
}


/* =========================
   DASHBOARD
========================= */

.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.card-title {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 10px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
}


/* =========================
   SECTIONS
========================= */

.content-section {
    width: 100%;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0 0 5px 0;
}

.section-header p {
    margin: 0;
    color: #6b7280;
}


/* =========================
   BUTTONS
========================= */

.primary-button,
.secondary-button {
    border-radius: 7px;
    padding: 10px 16px;
    font-weight: 600;
    border: 0;
}

.primary-button {
    background: #1976d2;
    color: white;
}

.primary-button:hover {
    background: #1565c0;
}

.secondary-button {
    background: #e7eaee;
    color: #333;
}

.secondary-button:hover {
    background: #dce1e6;
}


/* =========================
   FILTERS
========================= */

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 10px;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filters input,
.filters select {
    min-width: 0;
}


/* =========================
   TABLES
========================= */

.table-container {
    width: 100%;
    overflow-x: auto;
    background: white;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f0f2f4;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

th {
    font-size: 13px;
    font-weight: 700;
    color: #4b5563;
}

td {
    font-size: 14px;
}

tbody tr:hover {
    background: #f8fafc;
}


/* =========================
   TABLE ACTIONS
========================= */

.action-button {
    border: 0;
    border-radius: 5px;
    padding: 6px 9px;
    margin-right: 4px;
    font-size: 12px;
}

.edit-button {
    background: #e3f2fd;
    color: #1565c0;
}

.delete-button {
    background: #ffebee;
    color: #c62828;
}

.action-button:hover {
    opacity: 0.8;
}


/* =========================
   MODALS
========================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 50%;
    background: #eef0f2;
    color: #333;
    font-size: 24px;
    line-height: 1;
}

.modal-close:hover {
    background: #e1e4e7;
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}


/* =========================
   EMPTY STATE
========================= */

.empty-state {
    text-align: center;
    padding: 40px;
    color: #777;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

    .dashboard {
        grid-template-columns: 1fr;
    }

    .filters {
        grid-template-columns: 1fr 1fr;
    }

}

@media (max-width: 650px) {

    .topbar {
        padding: 0 15px;
    }

    .topbar-title {
        font-size: 18px;
    }

    .topbar-user span {
        display: none;
    }

    .main-content {
        padding: 20px 15px;
    }

    .navigation {
        overflow-x: auto;
    }

    .nav-button {
        white-space: nowrap;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    th,
    td {
        white-space: nowrap;
    }

}

/* =========================
   V-BUPOV DARK MODE
   ========================= */
html.dark-mode,
body.dark-mode {
    background: #10161d;
    color: #edf2f7;
}

/* Glavna stranica */
body.dark-mode .app {
    background: #10161d;
    color: #edf2f7;
}

body.dark-mode .main-content {
    background: #10161d;
}

/* Login */
body.dark-mode .login-screen {
    background: #10161d;
}

body.dark-mode .login-box {
    background: #1c2630;
    color: #edf2f7;
}

body.dark-mode .subtitle {
    color: #aab5c0;
}

/* Gornja traka */
body.dark-mode .topbar {
    background: #18232d;
    color: #edf2f7;
}

body.dark-mode .topbar-title,
body.dark-mode .topbar-user span {
    color: #edf2f7;
}

/* Navigacija */
body.dark-mode .navigation {
    border-bottom-color: #394550;
}

body.dark-mode .nav-button {
    color: #aeb9c4;
}

body.dark-mode .nav-button:hover,
body.dark-mode .nav-button.active {
    color: #4da3ff;
}

/* Dashboard kartice */
body.dark-mode .dashboard-card {
    background: #1c2630;
    color: #edf2f7;
    box-shadow: 0 2px 12px rgba(0,0,0,.30);
}

body.dark-mode .card-title {
    color: #aab5c0;
}

body.dark-mode .card-value {
    color: #edf2f7;
}

/* Sekcije */
body.dark-mode .section-header p {
    color: #aab5c0;
}

/* Filteri */
body.dark-mode .filters {
    background: #1c2630;
    color: #edf2f7;
    box-shadow: 0 2px 12px rgba(0,0,0,.30);
}

/* Sva polja */
body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea,
body.dark-mode .filters input,
body.dark-mode .filters select {
    background: #26333f;
    color: #edf2f7;
    border-color: #43515d;
}

body.dark-mode .form-group input::placeholder,
body.dark-mode .form-group textarea::placeholder,
body.dark-mode .filters input::placeholder {
    color: #9aa8b5;
}

body.dark-mode .form-group small {
    color: #9aa8b5;
}

/* Sekundarni gumb */
body.dark-mode .secondary-button {
    background: #303d49;
    color: #edf2f7;
}

body.dark-mode .secondary-button:hover {
    background: #3b4a57;
}

/* Tablica */
body.dark-mode .table-container {
    background: #1c2630;
    box-shadow: 0 2px 12px rgba(0,0,0,.30);
}

body.dark-mode thead {
    background: #26333f;
}

body.dark-mode th,
body.dark-mode td {
    color: #edf2f7;
    border-bottom-color: #394752;
}

body.dark-mode th {
    color: #c7d1da;
}

body.dark-mode tbody tr:hover {
    background: #26333f;
}

/* Akcije u tablici */
body.dark-mode .edit-button {
    background: #183c5a;
    color: #72b7ff;
}

body.dark-mode .delete-button {
    background: #4a2025;
    color: #ff8f99;
}

/* Modal */
body.dark-mode .modal {
    background: rgba(0, 0, 0, .78);
}

body.dark-mode .modal-content {
    background: #1c2630;
    color: #edf2f7;
}

body.dark-mode .modal-header {
    border-bottom-color: #394752;
}

body.dark-mode .modal-close {
    background: #303d49;
    color: #edf2f7;
}

body.dark-mode .modal-close:hover {
    background: #3b4a57;
}

/* Prazan sadržaj */
body.dark-mode .empty-state {
    color: #9aa8b5;
}

/* Theme gumb */
body.dark-mode #theme-toggle {
    background: #26333f;
    color: #edf2f7;
    border: 1px solid #43515d;
}

#theme-toggle {
    min-width: 38px;
    height: 34px;
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.3);
    background: transparent;
    color: white;
    cursor: pointer;
}

#theme-toggle:hover {
    background: rgba(255,255,255,.12);
}

body.dark-mode {
    --report-bg: #1c2630;
}

body.dark-mode {
    min-height: 100vh;
    background: #10161d;
}

body.dark-mode .app {
    min-height: 100vh;
    background: #10161d;
}

body.dark-mode .main-content {
    min-height: calc(100vh - 64px);
    background: #10161d;
}

body.dark-mode #monthlyReportOverlay select {
    background: #26333f !important;
    color: #edf2f7 !important;
    border-color: #43515d !important;
}

body.dark-mode #monthlyReportOverlay button {
    color: #edf2f7;
}

body.dark-mode #monthlyReportOverlay #monthlyReportGenerate {
    background: #1976d2 !important;
    color: white !important;
    border: 0 !important;
    border-radius: 7px;
    padding: 9px 12px;
}

body.dark-mode #monthlyReportOverlay #monthlyReportClose {
    background: #303d49 !important;
    color: #edf2f7 !important;
}
