/* ============================================
   KDV İade Takip Sistemi - Light Theme
   Profesyonel, temiz ve kurumsal tasarım
   ============================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

/* CSS Variables - Light Theme */
:root {
    /* Primary - Koyu Petrol Mavisi */
    --primary: #1e3a5f;
    --primary-dark: #152a45;
    --primary-light: #2d5a87;
    
    /* Accent - Altın/Bronz */
    --accent: #b8860b;
    --accent-light: #d4a017;
    
    /* Status Colors */
    --success: #2e7d32;
    --success-bg: #e8f5e9;
    --success-border: #a5d6a7;
    --warning: #ed6c02;
    --warning-bg: #fff3e0;
    --warning-border: #ffcc80;
    --danger: #c62828;
    --danger-bg: #ffebee;
    --danger-border: #ef9a9a;
    
    /* Background Colors */
    --bg-main: #f8f9fa;
    --bg-white: #ffffff;
    --bg-light: #f1f3f5;
    --bg-sidebar: #1e3a5f;
    
    /* Text Colors */
    --text-dark: #212529;
    --text-primary: #343a40;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --text-light: #ffffff;
    
    /* Border Colors */
    --border: #dee2e6;
    --border-light: #e9ecef;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    
    /* Sizing */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --sidebar-width: 260px;
    
    /* Transitions */
    --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 0 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.sidebar-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.nav-link.active {
    background: var(--accent);
    color: var(--text-light);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--shadow-xs);
}

.user-badge svg {
    color: var(--primary);
}

/* ============================================
   DASHBOARD STATS
   ============================================ */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-card.danger .value { color: var(--danger); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.success .value { color: var(--success); }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
}

.filter-bar input[type="text"],
.filter-bar select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    min-width: 200px;
}

.filter-bar input[type="text"]:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.filter-bar input[type="text"]::placeholder {
    color: var(--text-muted);
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: inherit;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   JOB CARDS
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.job-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.job-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.job-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.job-card.status-normal::before { background: var(--success); }
.job-card.status-yaklasan::before { background: var(--warning); }
.job-card.status-gecikti::before { background: var(--danger); }

.card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.card-header .donem {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-body {
    padding: 16px 20px;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.info-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Stage Badge */
.stage-badge {
    display: inline-flex;
    padding: 5px 12px;
    border-radius: var(--radius);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stage-badge.karsit { 
    background: #e3f2fd;
    color: #1565c0;
}

.stage-badge.ymm { 
    background: #ede7f6;
    color: #5e35b1;
}

.stage-badge.kontrol { 
    background: var(--warning-bg);
    color: #e65100;
}

.stage-badge.vd { 
    background: #fff8e1;
    color: #f57c00;
}

.stage-badge.eksiklik { 
    background: var(--danger-bg);
    color: var(--danger);
}

.stage-badge.tamamlandi { 
    background: var(--success-bg);
    color: var(--success);
}

/* Time Status */
.time-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.time-status.normal { color: var(--success); }
.time-status.yaklasan { color: var(--warning); }
.time-status.gecikti { color: var(--danger); }

.time-status svg {
    width: 16px;
    height: 16px;
}

/* Karşıt Progress */
.karsit-summary {
    display: flex;
    align-items: center;
    gap: 10px;
}

.karsit-summary span {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 36px;
}

.karsit-progress {
    flex: 1;
    height: 6px;
    background: var(--bg-light);
    border-radius: 3px;
    overflow: hidden;
}

.karsit-progress-bar {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

/* Warning Alert */
.card-warning {
    margin: 0 20px 16px;
    padding: 10px 14px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-warning svg {
    color: var(--danger);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.card-warning span {
    font-size: 0.8rem;
    color: var(--danger);
    font-weight: 500;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #256029;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #a12121;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-header .logo {
    width: 72px;
    height: 72px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
}

.login-header .logo svg {
    width: 36px;
    height: 36px;
}

.login-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    margin-bottom: 24px;
}

.error-message {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 18px;
    font-weight: 500;
}

.login-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
}

.modal-close {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    transition: var(--transition);
    display: flex;
}

.modal-close:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   TABLE
   ============================================ */
.table-container {
    overflow-x: auto;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 700;
    background: var(--bg-light);
}

td {
    font-size: 0.875rem;
    color: var(--text-primary);
}

tr:hover td {
    background: var(--bg-main);
}

tr:last-child td {
    border-bottom: none;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-bottom: 20px;
}

.settings-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-dark);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.setting-input {
    width: 90px;
    text-align: center;
    padding: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius);
    font-family: inherit;
}

.setting-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 360px;
    margin: 0 auto;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    background: var(--bg-light);
    padding: 4px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    width: fit-content;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
    font-family: inherit;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: white;
    background: var(--primary);
}

/* ============================================
   LOADING
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-bar input[type="text"],
    .filter-bar select {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card .value {
        font-size: 1.75rem;
    }
    
    .page-title {
        font-size: 1.35rem;
    }
}

/* ============================================
   TOAST
   ============================================ */
@keyframes slideIn {
    from { 
        transform: translateX(100%);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none !important; }
