/* ==========================================================================
   DEG İNŞAAT — Enterprise Construction & Fleet Management Design System
   Architecture: Minimal Swiss / Data-Dense B2B Dashboard
   Typography: Inter (Variable weights: 300, 400, 500, 600, 700)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --deg-primary: #2563eb;         /* Core Blue */
    --deg-primary-dark: #1d4ed8;
    --deg-primary-light: #60a5fa;
    --deg-accent-amber: #f59e0b;     /* Construction Safety Amber */
    --deg-accent-emerald: #10b981;   /* Finance / Success Emerald */
    --deg-accent-rose: #ef4444;      /* Danger / Overdue */
    
    --deg-bg-canvas: #090d16;        /* Deep Canvas Background */
    --deg-bg-surface: #0f172a;       /* Sidebar & Header Surface */
    --deg-bg-card: #162032;          /* Elevation 1 Cards */
    --deg-bg-card-hover: #1e293b;
    --deg-border: #233249;          /* Subtle Slate Borders */
    --deg-border-subtle: #1a2638;
    
    --deg-text-primary: #f8fafc;
    --deg-text-secondary: #94a3b8;
    --deg-text-muted: #64748b;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--deg-bg-canvas);
    color: var(--deg-text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Clean Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Monospace Helpers */
.font-mono-numbers {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

/* Cards & Surface Elevators */
.deg-card {
    background: var(--deg-bg-card);
    border: 1px solid var(--deg-border);
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.deg-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.deg-card-header {
    border-bottom: 1px solid var(--deg-border);
    padding: 0.9rem 1.25rem;
}

/* Navigation Buttons in Sidebar */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background-color: rgba(30, 41, 59, 0.7);
    color: #ffffff;
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.18) 0%, rgba(30, 41, 59, 0.4) 100%);
    color: #60a5fa;
    border-left-color: #3b82f6;
    font-weight: 600;
}

/* Sub-navigation Links (e.g. 4A / 4B under Haftalık Alışveriş) */
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.65rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
}

.sidebar-sublink:hover {
    background-color: rgba(30, 41, 59, 0.7);
    color: #ffffff;
}

.sidebar-sublink.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.22) 0%, rgba(30, 41, 59, 0.5) 100%);
    color: #93c5fd;
    border-left-color: #3b82f6;
    font-weight: 600;
}

/* Accordion Group Headers in Sidebar */
.sidebar-accordion-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.sidebar-accordion-btn:hover {
    background-color: rgba(30, 41, 59, 0.7);
    color: #ffffff;
}

.sidebar-accordion-btn.open {
    background-color: rgba(30, 41, 59, 0.45);
    color: #f8fafc;
}

.sidebar-accordion-btn.has-active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.16) 0%, rgba(30, 41, 59, 0.35) 100%);
    color: #60a5fa;
    border-left-color: #3b82f6;
}

/* Primary Action Buttons */
.btn-deg {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
}

.btn-deg:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn-deg:active {
    transform: translateY(0);
}

.btn-deg-accent {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
    transition: all 0.15s ease;
}

.btn-deg-accent:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

/* Table Design */
.deg-table {
    width: 100%;
    border-collapse: collapse;
}

.deg-table th {
    background: rgba(15, 23, 42, 0.85);
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--deg-border);
    white-space: nowrap;
}

.deg-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--deg-border-subtle);
    font-size: 0.84rem;
}

.deg-table tbody tr {
    transition: background-color 0.15s ease;
}

.deg-table tbody tr:hover td {
    background-color: rgba(30, 41, 59, 0.6);
}

/* Compact Table View (Default for Santiye Takibi and dense grids) */
.deg-table-compact {
    zoom: 0.88;
}

.deg-table-compact th {
    padding: 0.55rem 0.65rem;
    font-size: 0.69rem;
}

.deg-table-compact td {
    padding: 0.55rem 0.65rem;
    font-size: 0.77rem;
}

/* Modal Stilleri */
.deg-modal-backdrop {
    background-color: rgba(9, 13, 22, 0.82);
    backdrop-filter: blur(6px);
}

/* ==========================================================================
   Print / PDF Çıktı Düzenleri (Tam Sayfa ve Çoklu Sayfa Destekli)
   ========================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm 12mm 12mm 12mm;
    }

    /* Kök kapsayıcıların yükseklik ve taşma kilitlerini kaldır - çoklu sayfa akışını sağla */
    html, body {
        height: auto !important;
        min-height: 100% !important;
        overflow: visible !important;
        position: static !important;
        background-color: #ffffff !important;
        background-image: none !important;
        color: #0f172a !important;
        display: block !important;
    }

    #main-content-wrapper {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        position: static !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        top: 0 !important;
    }

    main {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        position: static !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Arayüz kalıntılarını, modalları ve gezinme butonlarını gizle */
    .no-print, 
    aside, 
    header, 
    #sidebar-backdrop, 
    .btn-deg, 
    .btn-deg-accent, 
    #toast-container,
    .tab-content.hidden,
    .fixed,
    dialog {
        display: none !important;
    }

    /* Aktif sekme görünür ve tüm içeriğiyle akıcı */
    .tab-content:not(.hidden) {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Tablo ve kart taşmalarını engelleme - tüm içeriği görünür yap */
    .overflow-x-auto, 
    .overflow-y-auto, 
    .overflow-hidden {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    /* Yazdırma başlığı */
    .print-only-header {
        display: block !important;
        margin-bottom: 1.25rem !important;
    }

    /* Kartlar & Tabloların Beyaz Zemin Baskı Uyumu */
    .deg-card {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        color: #0f172a !important;
        margin-bottom: 1.25rem !important;
        padding: 1rem !important;
        border-radius: 6px !important;
        page-break-inside: auto;
        break-inside: auto;
    }

    /* Metin renklerini yazdırmaya uygun yüksek kontrastlı tonlara çevir */
    .deg-card h1, .deg-card h2, .deg-card h3, .deg-card h4, .deg-card h5, .deg-card h6,
    .text-white, 
    .text-slate-100, 
    .text-slate-200 {
        color: #0f172a !important;
    }

    .text-slate-400, 
    .text-slate-500 {
        color: #475569 !important;
    }

    .text-amber-400, .text-amber-500 {
        color: #b45309 !important;
    }

    .text-emerald-400, .text-emerald-500 {
        color: #047857 !important;
    }

    .text-blue-400, .text-blue-500 {
        color: #1d4ed8 !important;
    }

    .text-purple-400, .text-purple-500 {
        color: #6d28d9 !important;
    }

    /* Tablo Düzeni */
    .deg-table {
        width: 100% !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    .deg-table th {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        border-bottom: 2px solid #334155 !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    .deg-table select {
        border: none !important;
        background: transparent !important;
        color: #0f172a !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        font-weight: 600 !important;
        padding: 0 !important;
    }

    .deg-table td {
        background: #ffffff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        color: #0f172a !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    thead {
        display: table-header-group !important;
    }

    tr {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* Grafikler ve KPI'lar */
    canvas {
        max-width: 100% !important;
        height: auto !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .grid {
        display: grid !important;
    }

    .grid > .deg-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Resizable Table Columns
   ========================================================================== */
.table-resizable {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.table-resizable th {
    position: relative;
    user-select: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-resizable td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-resizable td:last-child,
.table-resizable td.action-cell {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
}

.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
    transition: background-color 0.15s ease;
}

.col-resizer:hover,
.col-resizer.resizing {
    background-color: #3b82f6 !important;
    width: 6px;
}


/* ==========================================================================
   KULLANICI YETKİ (RBAC) GÖRÜNÜRLÜK KURALLARI
   ========================================================================== */
body.role-mode-user .role-admin-only,
body.role-mode-user .role-superadmin-only {
    display: none !important;
}

body.role-mode-admin .role-superadmin-only {
    display: none !important;
}


/* Filo & Bakım Analizleri Tab %20 Zoom Out */
#tab-rapor-filo {
    zoom: 0.8;
}


/* ==========================================================================
   İK (İNSAN KAYNAKLARI) VE PUANTAJ TABLO STİLLERİ
   ========================================================================== */

/* 5A. Çalışan Listesi Tablosu %15 Zoom Out (0.85) */
#tab-ik-calisanlar {
    zoom: 0.85;
}

/* 5B. Puantaj Cetveli Tablosu %15 Zoom Out (0.85) */
#tab-ik-puantaj {
    zoom: 0.85;
}

#employees-table {
    table-layout: fixed !important;
    width: 1040px !important;
}

#timesheet-main-table {
    table-layout: fixed !important;
    width: 1673px !important;
}

#employees-table th, #employees-table td {
    padding: 0.32rem 0.45rem !important;
    font-size: 0.72rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#timesheet-main-table th, #timesheet-main-table td {
    padding: 0.22rem 0.35rem !important;
    font-size: 0.70rem !important;
}

#timesheet-main-table th.ts-day-cell, #timesheet-main-table td.ts-day-cell {
    padding: 0 !important;
    min-width: 22px !important;
    width: 22px !important;
    max-width: 22px !important;
}

.ts-sticky-col {
    background-color: #0f172a;
}

.ts-sticky-col-header {
    background-color: #0d1424;
}

.ts-day-cell {
    min-width: 22px;
    width: 22px;
    padding: 0 !important;
    text-align: center;
    border-right: 1px solid rgba(51, 65, 85, 0.4);
}

.ts-day-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #10b981;
    margin: 3px auto;
    display: block;
}

.ts-ot-input {
    width: 100%;
    height: 22px;
    background: transparent;
    border: none;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #fbbf24;
    outline: none;
    padding: 0;
    transition: background-color 0.15s ease;
}

.ts-ot-input:focus {
    background-color: rgba(245, 158, 11, 0.25);
    color: #ffffff;
    font-weight: bold;
}

/* Sütun genişliği ayarlanabilir (resizable) başlıklar */
.ts-resizable-th {
    position: relative;
    user-select: none;
}

.ts-col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    cursor: col-resize;
    user-select: none;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.15s ease;
    z-index: 30;
}

.ts-col-resizer:hover,
.ts-col-resizer.is-resizing {
    background-color: #38bdf8 !important;
}

.ts-dotted-divider {
    border-bottom: 1px dashed rgba(71, 85, 105, 0.6);
}

.ts-weekend-col {
    background-color: rgba(15, 23, 42, 0.6);
}

.ts-weekend-header {
    background-color: rgba(30, 41, 59, 0.9) !important;
    color: #94a3b8 !important;
}

.workplace-pill {
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid #233249;
    background-color: #0f172a;
    color: #94a3b8;
    font-weight: 600;
    transition: all 0.15s ease;
}

.workplace-pill:hover,
.workplace-pill.active {
    background-color: rgba(20, 184, 166, 0.2);
    border-color: #14b8a6;
    color: #2dd4bf;
}
