/* ========================================================
   Filo Yönetimi Web — Ana Stil Dosyası
   Premium, modern tasarım sistemi
   ======================================================== */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font);
    background: var(--bg-primary, #f0f2f5);
    color: var(--text-primary, #1a1a2e);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ========== TOP BAR ========== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--surface-elevated, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.top-bar-left { display: flex; align-items: center; gap: 10px; }
.top-bar-logo { font-size: 28px; }
.top-bar-title {
    font-size: 20px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-secondary, #06b6d4));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.top-bar-right { display: flex; align-items: center; gap: 10px; }
.user-badge {
    padding: 6px 14px; border-radius: 20px;
    background: var(--surface-hover, #f3f4f6);
    font-size: 13px; font-weight: 500;
    color: var(--text-secondary, #6b7280);
}
.btn-icon {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--surface, #fff);
    cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--surface-hover, #f3f4f6); transform: scale(1.05); }
.btn-icon.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }

/* ========== TAB NAVIGATION ========== */
.tab-nav {
    display: flex;
    gap: 4px;
    padding: 10px 24px;
    background: var(--surface-elevated, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    overflow-x: auto;
    scrollbar-width: thin;
}
.tab-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: var(--radius-sm);
    border: none; background: transparent;
    color: var(--text-secondary, #6b7280);
    font-size: 13px; font-weight: 500;
    font-family: var(--font);
    cursor: pointer; white-space: nowrap;
    transition: var(--transition);
}
.tab-btn:hover { background: var(--surface-hover, #f3f4f6); color: var(--text-primary, #1a1a2e); }
.tab-btn.active {
    background: var(--accent, #7c3aed);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.tab-icon { font-size: 15px; }

/* ========== TAB CONTENT ========== */
.tab-content { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
.tab-pane { display: none; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ========== SUB TABS ========== */
.sub-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.sub-tab {
    padding: 8px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border, #e5e7eb);
    background: var(--surface, #fff);
    color: var(--text-secondary); font-size: 13px;
    font-family: var(--font); cursor: pointer;
    transition: var(--transition);
}
.sub-tab:hover { border-color: var(--accent, #7c3aed); }
.sub-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.sub-pane { display: none; animation: fadeIn 0.2s ease; }
.sub-pane.active { display: block; }

/* ========== DASHBOARD CARDS ========== */
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 20px; }
.dash-card {
    display: flex; align-items: center; gap: 16px;
    padding: 24px; border-radius: var(--radius-lg);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.dash-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.dash-card-icon { font-size: 36px; }
.dash-card-label { display: block; font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.dash-card-value { display: block; font-size: 24px; font-weight: 700; margin-top: 4px; }
.card-income .dash-card-value { color: #10b981; }
.card-expense .dash-card-value { color: #ef4444; }
.card-profit .dash-card-value { color: var(--accent, #7c3aed); }

/* ========== CHARTS ========== */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }
.chart-container {
    padding: 20px; border-radius: var(--radius);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    box-shadow: var(--shadow);
}
.chart-container h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.chart-container.full-width { grid-column: 1 / -1; }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.chart-header h3 { margin-bottom: 0; }

/* ========== DATA TABLE ========== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border, #e5e7eb); margin-top: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead {
    background: var(--surface-hover, #f9fafb);
    position: sticky; top: 0;
}
.data-table th {
    padding: 12px 14px; text-align: left;
    font-weight: 600; color: var(--text-secondary);
    border-bottom: 2px solid var(--border, #e5e7eb);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    color: var(--text-primary);
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--surface-hover, #f9fafb); }
.data-table tbody tr:nth-child(even) { background: var(--bg-secondary, #fafbfc); }
.data-table tbody tr:nth-child(even):hover { background: var(--surface-hover, #f3f4f6); }

/* Row Status Colors */
.row-paid { background: #ecfdf5 !important; }
.row-partial { background: #fffbeb !important; }
.row-overdue { background: #fef2f2 !important; }
.row-fatura td { background: rgba(239, 68, 68, 0.05); }
.row-odeme td { background: rgba(16, 185, 129, 0.05); }

/* ========== FORMS ========== */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }

.input-md, .input-sm, .input-full, .select-sm, textarea {
    padding: 10px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border, #e5e7eb);
    background: var(--surface, #fff);
    color: var(--text-primary);
    font-size: 14px; font-family: var(--font);
    transition: var(--transition);
    outline: none;
}
.input-md { min-width: 160px; }
.input-sm { min-width: 80px; width: 100px; }
.input-full { width: 100%; }
.select-sm { padding: 8px 10px; font-size: 12px; }
textarea { resize: vertical; }

.input-md:focus, .input-sm:focus, .input-full:focus, .select-sm:focus, textarea:focus {
    border-color: var(--accent, #7c3aed);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* Inline editable cells */
.editable-cell {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}
.editable-cell:hover { background: rgba(124, 58, 237, 0.1); }
.data-table td.selected-cell {
    background-color: rgba(124, 58, 237, 0.25) !important;
    outline: 2px solid var(--accent, #7c3aed);
    outline-offset: -2px;
}
/* Resizable Table Columns and Rows */
.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
}
.col-resizer:hover, .col-resizer.resizing {
    border-right: 3px solid var(--accent, #7c3aed);
    background: transparent;
}
.row-resizer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    cursor: row-resize;
    user-select: none;
    z-index: 10;
}
.row-resizer:hover, .row-resizer.resizing {
    border-bottom: 3px solid var(--accent, #7c3aed);
    background: transparent;
}

/* Alignments and Stack cells */
.data-table th, .data-table td {
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    position: relative; /* essential for handles */
}
.data-table td.stack-cell,
.data-table td[data-col="driver_name"] {
    white-space: normal !important;
    word-break: break-word;
    text-align: center;
}
.edit-input {
    width: 100%; padding: 4px 6px; border-radius: 4px;
    border: 2px solid var(--accent, #7c3aed);
    background: var(--surface); color: var(--text-primary);
    font-size: 13px; font-family: var(--font);
    outline: none;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 10px 18px; border-radius: var(--radius-sm);
    border: none; font-size: 13px; font-weight: 600;
    font-family: var(--font); cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent, #7c3aed); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35); }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35); }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35); }
.btn-secondary { background: var(--surface-hover, #e5e7eb); color: var(--text-primary); }
.btn-muted { background: #9ca3af; color: #fff; }
.btn-purple { background: #7c3aed; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.full-width { width: 100%; }

/* ========== BADGE ========== */
.badge {
    padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 600;
    background: var(--surface-hover); color: var(--text-primary);
}

/* ========== STATUS BANNER ========== */
.status-banner {
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 12px; font-size: 14px; font-weight: 500;
}
.status-banner.loading { background: #dbeafe; color: #1e40af; }
.status-banner.success { background: #dcfce7; color: #166534; }
.status-banner.error { background: #fee2e2; color: #991b1b; }

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; animation: fadeIn 0.2s ease;
}
.modal-card {
    background: var(--surface, #fff);
    border-radius: var(--radius-lg);
    padding: 30px; max-width: 500px; width: 90%;
    box-shadow: var(--shadow-lg);
}
.modal-card.modal-wide { max-width: 800px; }
.modal-card h3 { font-size: 18px; margin-bottom: 18px; color: var(--text-primary); }
.modal-card label { display: block; font-size: 13px; font-weight: 500; margin: 10px 0 4px; color: var(--text-secondary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ========== SETTINGS ========== */
.settings-scroll { max-height: calc(100vh - 180px); overflow-y: auto; }
.settings-group {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius);
    padding: 24px; margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.settings-group h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.settings-info { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.5; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 14px; cursor: pointer; }

/* ========== LEDGER SUMMARY ========== */
.ledger-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; padding: 14px; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.text-danger { color: #ef4444; font-weight: 600; }
.text-success { color: #10b981; font-weight: 600; }
.text-bold { font-weight: 700; font-size: 15px; margin-left: auto; }

/* ========== LOG TERMINAL ========== */
.log-terminal {
    background: #0d1117; color: #3fb950;
    padding: 20px; border-radius: var(--radius);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px; line-height: 1.7;
    max-height: calc(100vh - 240px);
    overflow-y: auto; white-space: pre-wrap;
    border: 1px solid #30363d;
}

/* ========== CARD ========== */
.card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.card.full-width { margin-top: 16px; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-cards { grid-template-columns: 1fr; }
    .tab-content { padding: 12px 14px; }
    .top-bar { padding: 10px 14px; flex-direction: column; gap: 8px; text-align: center; }
    .top-bar-right { width: 100%; justify-content: center; }
    .tab-nav { padding: 6px 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-text { display: inline-block; font-size: 12px; }
    .tab-btn { padding: 8px 12px; }
    
    .sub-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        gap: 6px;
    }
    .sub-tab {
        white-space: nowrap !important;
        padding: 6px 12px;
        font-size: 12px;
    }

    .form-row, .inline-form { 
        flex-direction: column !important; 
        align-items: stretch !important; 
        width: 100% !important; 
        gap: 8px !important;
    }
    .input-md, .input-sm, .input-full, .select-sm, textarea, .btn { 
        width: 100% !important; 
        min-width: 0 !important; 
    }
    
    .ledger-summary { flex-direction: column; gap: 8px; }
    .text-bold { margin-left: 0; }
    
    /* Table responsive wrappers */
    .table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Settings scroll spacing */
    .settings-scroll {
        max-height: none;
        overflow-y: visible;
    }
    .settings-group {
        padding: 16px;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border, #d1d5db); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary, #9ca3af); }

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--radius-sm);
    color: #fff; font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 360px;
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #3b82f6; }
@keyframes slideIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ========== EXPENSE FORM ========== */
.expense-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
