/* ═══════════════════════════════════════
   LARVICIDI APV - Stylesheet
   ═══════════════════════════════════════ */

:root {
    --primary: #1e3a5f;
    --primary-light: #2c5282;
    --primary-dark: #152a45;
    --accent: #38a169;
    --accent-light: #48bb78;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ─── SIDEBAR ─── */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s ease;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.logo i { font-size: 22px; color: var(--accent-light); }

.sidebar-toggle {
    background: none; border: none;
    color: white; cursor: pointer;
    font-size: 18px; padding: 4px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
}

.sidebar-user i { font-size: 28px; opacity: 0.8; }
.sidebar-user small { display: block; opacity: 0.6; font-size: 11px; }

.nav-menu {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.nav-section {
    padding: 12px 16px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.4;
    white-space: nowrap;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-menu a:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-menu a.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left: 3px solid var(--accent-light);
}

.nav-menu a i { width: 20px; text-align: center; font-size: 14px; }

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 8px;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
}

.sidebar-footer a:hover { background: rgba(255,255,255,0.1); color: white; }

/* ─── MAIN CONTENT ─── */
main.with-sidebar {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px;
    transition: margin-left 0.3s ease;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.page-header h1 i { margin-right: 8px; opacity: 0.7; }

/* ─── CARDS ─── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

/* ─── STATS GRID ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.stat-icon.blue { background: var(--primary-light); }
.stat-icon.green { background: var(--accent); }
.stat-icon.orange { background: var(--warning); }
.stat-icon.red { background: var(--danger); }

.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: var(--primary);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
}

tr:hover { background: #f7fafc; }
tr:nth-child(even) { background: #fafbfc; }
tr:nth-child(even):hover { background: #f0f4f8; }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--accent); color: white; }
.btn-success:hover { background: var(--accent-light); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c53030; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

textarea { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

/* ─── MODAL ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
}

.modal h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ─── BADGES ─── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-planiran { background: #ebf8ff; color: #2b6cb0; }
.badge-u_toku { background: #fefcbf; color: #975a16; }
.badge-zavrsen { background: #f0fff4; color: #276749; }
.badge-otkazan { background: #fff5f5; color: #c53030; }
.badge-kreirano { background: #ebf8ff; color: #2b6cb0; }
.badge-poslato { background: #f0fff4; color: #276749; }
.badge-greska { background: #fff5f5; color: #c53030; }

/* ─── TOAST ─── */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    margin-top: 8px;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success { background: var(--accent); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary-light); }

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

/* ─── LOGIN ─── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    width: 380px;
    max-width: 90%;
}

.login-card .logo {
    color: var(--primary);
    justify-content: center;
    font-size: 22px;
    margin-bottom: 8px;
}

.login-card .logo i { color: var(--accent); }

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-card .btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }

.login-error {
    background: #fff5f5;
    color: var(--danger);
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
}

/* ─── PASTE AREA ─── */
.paste-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.paste-area:hover, .paste-area.dragover {
    border-color: var(--primary-light);
    background: #f7fafc;
}

.paste-area i { font-size: 32px; opacity: 0.4; }

/* ─── CHECKBOX ─── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .sidebar.open { transform: translateX(0); }

    main.with-sidebar { margin-left: 0; padding: 16px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

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

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

    .mobile-toggle {
        display: block !important;
        position: fixed;
        top: 12px; left: 12px;
        z-index: 101;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 18px;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
    }
}

.mobile-toggle { display: none; }

/* ─── UTILITY ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; opacity: 0.3; margin-bottom: 12px; display: block; }
