* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5a8a;
    --primary-dark: #0f1f33;
    --accent: #c9a227;
    --accent-light: #e6c54d;
    --bg-dark: #0a0f1a;
    --bg-card: #121a2d;
    --bg-card-hover: #1a2640;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --border-color: #2a3f5f;
    --success: #10b981;
    --emergency: #ef4444;
    --district: #8b5cf6;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0f172a 50%, #1a1f35 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.emblem {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary-dark);
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.3);
}

.title-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 2px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 16px;
    min-width: 300px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.2);
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.print-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border: none;
    border-radius: 10px;
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.3);
}

.print-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}

.print-btn:active {
    transform: translateY(0);
}

.print-btn i {
    font-size: 1rem;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(30, 58, 95, 0.4);
}

.tab-btn i {
    font-size: 1rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Departments Grid */
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Department Card */
.department-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.department-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--accent);
}

.department-card.district .card-header {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.department-card.district .dept-icon {
    background: linear-gradient(135deg, var(--district) 0%, #a78bfa 100%);
}

.card-header {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.5) 0%, rgba(30, 58, 95, 0.2) 100%);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.dept-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
}

.dept-icon.emergency {
    background: linear-gradient(135deg, var(--emergency) 0%, #dc2626 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.dept-info {
    flex: 1;
    min-width: 0;
}

.dept-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.email-badge {
    display: inline-block;
    background: rgba(201, 162, 39, 0.15);
    color: var(--accent-light);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 4px;
    margin-bottom: 4px;
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.email-badge.secondary {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.3);
}

/* Staff List */
.staff-list {
    list-style: none;
    padding: 12px 16px;
}

.staff-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(42, 63, 95, 0.5);
    transition: all 0.2s ease;
}

.staff-list li:last-child {
    border-bottom: none;
}

.staff-list li:hover {
    padding-left: 8px;
}

.staff-list .name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.staff-list .username {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(148, 163, 184, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    margin-top: 32px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 16px;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }

    .tab-nav {
        flex-direction: column;
    }

    .tab-btn {
        justify-content: center;
    }

    .departments-grid {
        grid-template-columns: 1fr;
    }

    .title-section h1 {
        font-size: 1.4rem;
    }
}

/* Hidden class for search */
.hidden {
    display: none !important;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results p {
    font-size: 1.1rem;
}

/* Print Styles */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: white !important;
        color: #000 !important;
        font-size: 10pt;
        margin: 0;
        padding: 0;
    }

    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .header {
        background: #1e3a5f !important;
        border-radius: 0;
        margin-bottom: 8px;
        padding: 8px 15px;
        box-shadow: none;
        border: none;
    }

    .header-content {
        gap: 8px;
    }

    .header-actions,
    .search-box,
    .print-btn,
    .tab-nav,
    .footer {
        display: none !important;
    }

    .main-content {
        margin-top: 0;
    }

    .tab-content {
        display: block !important;
        page-break-inside: auto;
        margin-bottom: 10px;
    }

    .tab-content::before {
        content: attr(data-title);
        display: block;
        font-size: 12pt;
        font-weight: 700;
        color: #1e3a5f;
        margin-bottom: 8px;
        padding-bottom: 4px;
        border-bottom: 2px solid #1e3a5f;
    }

    #valilik::before {
        content: "VALİLİK BİRİMLERİ";
    }

    #ilceler {
        page-break-before: always;
    }

    #ilceler::before {
        content: "İLÇE KAYMAKAMLIKLARI";
        margin-top: 0;
    }

    .departments-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .department-card {
        background: #f8f9fa !important;
        border: 1px solid #adb5bd !important;
        border-radius: 6px;
        page-break-inside: avoid;
        box-shadow: none;
    }

    .department-card:hover {
        transform: none;
        box-shadow: none;
    }

    .card-header {
        background: #dee2e6 !important;
        padding: 6px 10px;
    }

    .dept-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 0.8rem;
        background: #1e3a5f !important;
    }

    .dept-icon.emergency {
        background: #dc3545 !important;
        animation: none;
    }

    .department-card.district .dept-icon {
        background: #6f42c1 !important;
    }

    .dept-info h3 {
        font-size: 9pt;
        font-weight: 700;
        color: #000 !important;
        margin-bottom: 3px;
    }

    .email-badge {
        background: #fff3cd !important;
        color: #856404 !important;
        border: 1px solid #ffc107 !important;
        font-size: 8pt;
        font-weight: 500;
        padding: 2px 6px;
    }

    .email-badge.secondary {
        background: #fff3cd !important;
        color: #856404 !important;
        border: 1px solid #ffc107 !important;
    }

    .staff-list {
        padding: 6px 10px;
    }

    .staff-list li {
        padding: 3px 0;
        border-bottom: 1px solid #dee2e6;
    }

    .staff-list li:last-child {
        border-bottom: none;
    }

    .staff-list li:hover {
        padding-left: 0;
    }

    .staff-list .name {
        font-size: 8pt;
        font-weight: 600;
        color: #000 !important;
    }

    .staff-list .username {
        font-size: 8pt;
        color: #000 !important;
        background: #d1d5db !important;
        font-weight: 600;
        padding: 2px 6px;
        border-radius: 3px;
    }

    .hidden {
        display: none !important;
    }

    .no-results {
        display: none !important;
    }

    /* Print header override */
    .emblem {
        width: 32px;
        height: 32px;
        font-size: 16px;
        background: #c9a227 !important;
        border-radius: 6px;
    }

    .title-section h1 {
        font-size: 14pt;
        color: white !important;
        -webkit-text-fill-color: white !important;
        border: none !important;
        text-decoration: none !important;
        background: none !important;
        -webkit-background-clip: unset !important;
        background-clip: unset !important;
    }

    .title-section p {
        color: #ccc !important;
        font-size: 9pt;
        margin-top: 0;
    }

    .logo-section {
        gap: 10px;
    }
}