/* ============================================================
   MetütERP — Merkezi Stil Dosyası
   Tüm sayfa içi <style> blokları buraya taşınmıştır.
   Bölümler:
   1. Genel iskelet (layout)      5. Tablo filtre satırı / Select2
   2. Sidebar                     6. Web CBS (map.php)
   3. Üst bar (topbar)            7. Giriş sayfası (login)
   4. Dashboard bileşenleri       8. Yazdırma (print)
   ============================================================ */

/* ---------- 1. GENEL İSKELET ---------- */
body {
    background-color: #f4f6f9;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

.main-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background-color: #f4f6f9;
}

/* ---------- 2. SIDEBAR ---------- */
.sidebar {
    width: 280px;
    background-color: #212529;
    color: #fff;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 1050;
    overflow-y: auto;
    overflow-x: hidden;
    top: 0;
    left: 0;
    bottom: 0;
}

/* İnce, modern scrollbar */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 10px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.4); }

.sidebar.collapsed { margin-left: -280px; }

.sidebar-brand-area {
    height: 60px;
    background-color: #1a1d20;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #2c3034;
}

.sidebar .nav-link-main {
    color: rgba(255, 255, 255, .75);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.sidebar .nav-link-main:hover { background-color: rgba(255, 255, 255, 0.05); color: #fff; }
.sidebar .nav-link-main.active { background-color: #0d6efd; color: #fff; }
.sidebar .nav-link-main i.nav-icon { width: 20px; text-align: center; }

.sidebar .accordion-item { background: transparent; border: none; }
.sidebar .accordion-button {
    background: transparent;
    color: rgba(255, 255, 255, .75);
    padding: 12px 20px;
    box-shadow: none;
    border-radius: 0;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.sidebar .accordion-button:not(.collapsed) { background: rgba(255, 255, 255, 0.04); color: #fff; }
.sidebar .accordion-button::after { filter: invert(1); transform: scale(0.8); }

.sidebar .submenu-list { list-style: none; padding-left: 0; margin-bottom: 0; background: #1a1d20; }
.sidebar .submenu-item a {
    display: block;
    padding: 10px 20px 10px 45px;
    color: rgba(255, 255, 255, .6);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.01);
}
.sidebar .submenu-item a:hover { color: #fff; background: rgba(255, 255, 255, 0.03); }
.sidebar .submenu-item a.active {
    color: #fff;
    background: rgba(13, 110, 253, 0.2);
    font-weight: bold;
    border-left: 4px solid #0d6efd;
    padding-left: 41px;
}

.sidebar-section-label {
    font-size: 0.75rem;
}

/* ---------- 3. ÜST BAR (TOPBAR) ---------- */
.navbar-top {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #495057;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}
.toggle-btn:hover { background: #f1f3f5; color: #0d6efd; }

/* ---------- 4. DASHBOARD BİLEŞENLERİ ---------- */
.kpi-icon {
    font-size: 5rem;
    right: -10px;
    top: 20px;
}
.kpi-progress { height: 6px; background-color: rgba(255, 255, 255, 0.2); }
.kpi-progress-label { font-size: 0.70rem; }
.kpi-mini-label { font-size: 0.65rem; }

.timeline { border-left: 2px solid #e9ecef; }
.timeline-dot { left: -24px; top: 12px; }
.timeline-title { font-size: 0.95rem; }
.timeline-time { font-size: 0.75rem; }
.badge-xs { font-size: 0.65rem; }

#dashboardMap { height: 420px; border-radius: 12px; }

/* ---------- 5. TABLO FİLTRE SATIRI / SELECT2 ---------- */
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    color: #495057;
    font-size: 0.85rem;
    padding: 2px 5px;
}
.filter-row th { padding: 4px !important; }

.json-block {
    max-height: 80px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.75rem;
    background: #f8fafc;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    width: 250px;
    white-space: pre-wrap;
}

/* ---------- 6. WEB CBS (map.php) ---------- */
.gis-wrapper {
    display: flex;
    height: calc(100vh - 120px);
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: margin-left 0.3s ease;
}

.gis-sidebar {
    width: 350px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.gis-sidebar-header {
    background: #212529;
    color: white;
    padding: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.gis-sidebar-content { flex-grow: 1; overflow-y: auto; }

#map { flex-grow: 1; height: 100%; z-index: 1; background: #e5e3df; }

/* Katman ağacı (tree view) */
.tree-root { list-style: none; padding-left: 0; margin-bottom: 0; }
.tree-camp { list-style: none; padding-left: 20px; display: block; margin-top: 5px; }
.tree-year { list-style: none; padding-left: 24px; display: block; margin-top: 2px; }
.tree-node {
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    padding: 12px 15px;
    transition: background 0.2s;
}
.tree-node:hover { background: #f1f3f5; }
.caret {
    cursor: pointer;
    user-select: none;
    width: 20px;
    display: inline-block;
    text-align: center;
    color: #6c757d;
    transition: 0.2s;
    font-size: 14px;
}
.caret:hover { color: #0d6efd; }
.caret-down { transform: rotate(90deg); }
.opacity-slider { height: 10px; cursor: pointer; }

/* Harita içi kontroller */
.leaflet-control-zoom-indicator {
    background: rgba(255, 255, 255, 0.9);
    padding: 0 8px;
    font-size: 12px;
    font-weight: bold;
    line-height: 28px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: #333;
}
.leaflet-control-mouseposition {
    background: rgba(255, 255, 255, 0.85);
    padding: 2px 8px;
    font-size: 11px;
    font-family: monospace;
    border-radius: 4px;
    color: #333;
}
.north-arrow {
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    width: 36px;
    height: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.north-arrow i { font-size: 20px; color: #dc3545; margin-bottom: -2px; }
.north-arrow span { font-size: 11px; font-weight: 900; color: #333; line-height: 1; }

.map-legend {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
    font-size: 13px;
    color: #333;
    line-height: 20px;
    min-width: 140px;
}
.map-legend h6 {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    text-transform: uppercase;
}
.map-legend i {
    width: 16px;
    height: 16px;
    float: left;
    margin-right: 8px;
    border-radius: 50%;
    opacity: 0.9;
    border: 1px solid rgba(0, 0, 0, 0.2);
}
.map-legend i.legend-poly { border-radius: 2px; }

/* CBS akordiyon düzeltmeleri */
.gis-sidebar .accordion-button { font-weight: bold; color: #333; padding: 12px 15px; }
.gis-sidebar .accordion-button:not(.collapsed) {
    background-color: #e7f1ff;
    color: #0d6efd;
    box-shadow: none;
    border-bottom: 1px solid #dee2e6;
}
.gis-sidebar .accordion-button:focus { box-shadow: none; border-color: rgba(0, 0, 0, .125); }
.gis-sidebar .accordion-body { padding: 0; background: #fff; }

/* Ruhsat poligon önizleme haritası (modal) */
#licensePreviewMap { height: 420px; width: 100%; border-radius: 8px; }

/* ---------- 7. GİRİŞ SAYFASI ---------- */
body.login-page {
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
.login-header {
    background: linear-gradient(135deg, #0d6efd, #0dcaf0);
    color: white;
    text-align: center;
    padding: 30px 20px;
    border-radius: 15px 15px 0 0;
}
.login-icon { font-size: 3rem; margin-bottom: 10px; }

/* ---------- 8. YAZDIRMA (PRINT) ---------- */
@media print {
    nav, .navbar, .navbar-top, .sidebar, #report-selector, .btn, footer, .no-print, .filter-row {
        display: none !important;
    }
    body { background-color: #fff !important; }
    .content-wrapper { margin: 0 !important; padding: 0 !important; width: 100% !important; }
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
    }
    .text-muted, .text-primary, .text-secondary { color: #000 !important; }
    .badge { border: 1px solid #000 !important; color: #000 !important; background-color: #fff !important; }
    @page { margin: 1cm; }
}

/* ---------- Toplu Veri Aktarımı ---------- */
.module-card { transition: transform 0.15s, box-shadow 0.15s; }
.module-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(13, 110, 253, 0.15) !important; }

/* ============================================================
   9. KOYU TEMA (data-bs-theme="dark")
   Bootstrap 5.3 bileşenleri otomatik kararır; buradakiler
   özel bileşenlerin ve sabit renkli alanların düzeltmeleridir.
   ============================================================ */
[data-bs-theme="dark"] body { background-color: #16181c; }
[data-bs-theme="dark"] .content-wrapper { background-color: #16181c; }
[data-bs-theme="dark"] .navbar-top { background: #212529; border-bottom-color: #343a40; }
[data-bs-theme="dark"] .toggle-btn { color: #adb5bd; }
[data-bs-theme="dark"] .toggle-btn:hover { background: #2b3035; color: #6ea8fe; }
[data-bs-theme="dark"] .footer { background-color: #212529 !important; border-top-color: #343a40 !important; }
[data-bs-theme="dark"] .card .card-header.bg-white { background-color: #212529 !important; color: #dee2e6; }
[data-bs-theme="dark"] .bg-light:not(.badge):not(.btn) { background-color: #2b3035 !important; }
[data-bs-theme="dark"] .text-dark { color: #dee2e6 !important; }
[data-bs-theme="dark"] .badge.bg-light { background-color: #343a40 !important; color: #adb5bd !important; }

/* Web CBS panelleri */
[data-bs-theme="dark"] .gis-wrapper { background: #212529; border-color: #343a40; }
[data-bs-theme="dark"] .gis-sidebar { background: #212529; border-right-color: #343a40; }
[data-bs-theme="dark"] .tree-node { background: #212529; border-bottom-color: #343a40; }
[data-bs-theme="dark"] .tree-node:hover { background: #2b3035; }
[data-bs-theme="dark"] .gis-sidebar .accordion-body { background: #212529; }
[data-bs-theme="dark"] .gis-sidebar .accordion-button { color: #dee2e6; }
[data-bs-theme="dark"] .map-legend,
[data-bs-theme="dark"] .leaflet-control-zoom-indicator,
[data-bs-theme="dark"] .leaflet-control-mouseposition,
[data-bs-theme="dark"] .north-arrow { background: rgba(33, 37, 41, 0.95); color: #dee2e6; }
[data-bs-theme="dark"] .north-arrow span { color: #dee2e6; }
[data-bs-theme="dark"] .map-legend h6 { border-bottom-color: #495057; }

/* Log blokları ve giriş sayfası */
[data-bs-theme="dark"] .json-block { background: #212529; border-color: #495057; color: #adb5bd; }
[data-bs-theme="dark"] body.login-page { background-color: #16181c; }
[data-bs-theme="dark"] .login-card { background: #212529; }

/* Zaman çizelgesi ve filtre satırı */
[data-bs-theme="dark"] .timeline { border-left-color: #343a40 !important; }
[data-bs-theme="dark"] .filter-row { background-color: #212529 !important; }
[data-bs-theme="dark"] .select2-container--classic .select2-selection--single,
[data-bs-theme="dark"] .select2-container--classic .select2-selection--multiple { background: #2b3035; border-color: #495057; color: #dee2e6; }
