
/* Fix for datalist and select dropdown text visibility */
:root {
    color-scheme: dark;
}
option, select, datalist {
    background-color: #161b27;
    color: #f1f5f9;
}
/* =========================================
   TOOKANALYZ — DARK GLASSMORPHISM UI
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Core Palette */
    --bg-deep:        #080b14;
    --bg-surface:     #0d1117;
    --bg-elevated:    #161b27;
    --glass-bg:       rgba(255, 255, 255, 0.04);
    --glass-border:   rgba(255, 255, 255, 0.08);
    --glass-hover:    rgba(255, 255, 255, 0.07);

    /* Accent Colors */
    --accent-primary:  #7c3aed;   /* violet */
    --accent-cyan:     #06b6d4;   /* cyan */
    --accent-green:    #10b981;   /* emerald */
    --accent-amber:    #f59e0b;   /* amber */
    --accent-red:      #ef4444;   /* red */

    /* Gradient */
    --grad-primary: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --grad-header:  linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #0c1a2e 100%);

    /* Text */
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;

    /* Shadows */
    --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md:  0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-lg:  0 20px 60px rgba(0, 0, 0, 0.7);
    --glow:       0 0 20px rgba(124, 58, 237, 0.3);
    --glow-cyan:  0 0 20px rgba(6, 182, 212, 0.3);

    /* Legacy compat */
    --primary-color: var(--accent-primary);
    --secondary-color: var(--accent-cyan);
    --bg-gradient-start: #7c3aed;
    --bg-gradient-end: #06b6d4;
}

/* ---- Base ---- */

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 80% 40% at 50% -10%, rgba(124, 58, 237, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 30% at 80% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 0;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-surface);
    min-height: 100vh;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.6);
}

/* ---- Header ---- */

header {
    background: var(--grad-header);
    padding: 36px 48px 28px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(124, 58, 237, 0.2);
    width: 100%;
    box-sizing: border-box;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--grad-primary);
    opacity: 0.4;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

header h1 img {
    display: none; /* handled by emoji/text */
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Dashboard Stats */
#dashboard-stats {
    display: flex;
    gap: 14px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-card {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 14px 20px !important;
    min-width: 200px;
    flex: 1;
    transition: all 0.3s ease;
    /* backdrop-filter kaldırıldı — scroll sırasında GPU siyah ekran bug'ına yol açıyordu */
}

.stat-card:hover {
    border-color: rgba(124, 58, 237, 0.3) !important;
    background: var(--glass-hover) !important;
}

.stat-card > div:first-child {
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted) !important;
    font-weight: 600;
    margin-bottom: 6px;
}

#stat-overdue-count, #stat-upcoming-count {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
}

#dashboard-alerts {
    margin-top: 16px;
}

/* Header Logout */
#header-logout-btn {
    position: absolute !important;
    right: 20px !important;
    top: 20px !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: var(--text-secondary) !important;
    font-size: 0.8rem !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.2s;
}

#header-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: var(--accent-red) !important;
}

/* ---- Navigation Tabs ---- */

.tabs {
    display: flex;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--glass-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 1;
    min-width: 100px;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    transition: all 0.25s ease;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.06);
}

/* ---- Import Sub-tabs ---- */
.import-sub-btn {
    padding: 8px 18px;
    border: none;
    background: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}
.import-sub-btn:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
}
.import-sub-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

/* ---- Inline Editable Date Cells ---- */
.inv-editable-date .edit-pencil {
    opacity: 0;
    font-size: .75rem;
    margin-left: 5px;
    transition: opacity .15s;
}
.inv-editable-date:hover {
    background: rgba(124, 58, 237, 0.08);
    border-radius: 6px;
}
.inv-editable-date:hover .edit-pencil {
    opacity: 1;
}

/* ---- Tab Content ---- */

.tab-content {
    display: none;
    padding: 36px 48px;
    animation: fadeSlideIn 0.3s ease;
    background: var(--bg-surface);
    min-height: 500px;
    width: 100%;
    box-sizing: border-box;
}

.tab-content.active {
    display: block;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Cards ---- */

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    transition: border-color 0.3s ease;
}

.card:hover {
    border-color: rgba(124, 58, 237, 0.2);
}

.card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.card h3 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 20px 0 14px;
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 18px;
    line-height: 1.6;
}

/* ---- Upload Area ---- */

.upload-area {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.file-name {
    color: var(--accent-cyan);
    font-style: italic;
    font-size: 0.9rem;
}

/* ---- Buttons ---- */

.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.1px;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background 0.2s;
    border-radius: inherit;
}

.btn:hover::after {
    background: rgba(255,255,255,0.08);
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 0 0 rgba(124,58,237,0);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow), 0 4px 16px rgba(124, 58, 237, 0.5);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4), 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 7px 14px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 16px rgba(239,68,68,0.2);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

.btn-small, .btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* PDF button — subtle icon style */
.btn-pdf {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.25);
    padding: 5px 10px;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-pdf:hover {
    background: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
    color: #fff;
}

/* ---- Result Messages ---- */

.result-message {
    margin-top: 16px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    font-weight: 500;
}

.result-message.success {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: block;
}

.result-message.error {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: block;
}

/* ---- Form Sections & Inputs ---- */

.form-section {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.form-group:last-child { margin-bottom: 0; }

.form-group label {
    font-weight: 600;
    min-width: 120px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    transition: all 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.input::placeholder { color: var(--text-muted); }

.input:hover {
    border-color: rgba(255,255,255,0.15);
}

.input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.06);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* Color inputs */
input[type="color"] {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    width: 50px !important;
    height: 36px !important;
    cursor: pointer;
    padding: 2px;
}

/* ---- Tables ---- */

.table-container {
    overflow-x: auto;
    margin-top: 18px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    font-size: 0.88rem;
}

thead {
    background: linear-gradient(135deg, rgba(124,58,237,0.25) 0%, rgba(6,182,212,0.15) 100%);
}

th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

td {
    padding: 11px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Status Badges ---- */

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: inline-block;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.badge-partial {
    background: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

/* Pay type toggle buttons */
.pay-type-btn {
    flex: 1;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
    font-size: .88rem;
    font-weight: 600;
    transition: all .2s;
}
.pay-type-btn.active {
    background: rgba(16,185,129,0.15);
    border-color: #10b981;
    color: #10b981;
}
.pay-type-btn:not(.active):hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

/* ---- Alerts ---- */

.alert {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 10px;
    font-weight: 500;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

/* ---- Unmapped Items ---- */

.unmapped-item {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.unmapped-item:hover {
    border-color: rgba(245, 158, 11, 0.35);
}

.unmapped-item h4 {
    color: var(--accent-amber);
    margin-bottom: 10px;
    font-size: 0.95rem;
    font-weight: 600;
}

/* ---- Suggestions ---- */

.suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.suggestion-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.suggestion-card:hover {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--glow);
}

.suggestion-card.selected {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
}

.score-badge {
    display: inline-block;
    background: rgba(124, 58, 237, 0.25);
    color: #c4b5fd;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 6px;
}

/* ---- Analytics ---- */

.analytics-section {
    margin-top: 28px;
}

#price-chart {
    max-height: 380px;
    margin: 20px 0;
}

/* Trends */
.trend-list {
    list-style: none;
    padding: 0;
}

.trend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    border-radius: 6px;
    cursor: pointer;
}

.trend-item:hover { background: rgba(255,255,255,0.04); }
.trend-item:last-child { border-bottom: none; }

.trend-info { display: flex; flex-direction: column; gap: 2px; }
.trend-name { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
.trend-meta { font-size: 0.75rem; color: var(--text-muted); }

.trend-stats { text-align: right; }
.trend-slope { font-weight: 700; font-size: 0.88rem; display: block; }
.trend-price { font-size: 0.75rem; color: var(--text-muted); }
.trend-rise { color: var(--accent-red); }
.trend-fall { color: var(--accent-green); }

/* Trend period selector */
.trend-period-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s;
}
.trend-period-btn:hover {
    background: rgba(124,58,237,0.15);
    border-color: rgba(124,58,237,0.4);
    color: var(--text-primary);
}
.trend-period-btn.active {
    background: rgba(124,58,237,0.25);
    border-color: #7c3aed;
    color: #a78bfa;
}

/* Anomaly banner rows */
.anomaly-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: 8px;
    font-size: 0.83rem;
    flex-wrap: wrap;
}
.anomaly-row .an-product { font-weight: 700; color: var(--text-primary); flex: 1; min-width: 120px; }
.anomaly-row .an-deviation { font-weight: 700; }
.anomaly-row .an-deviation.up { color: #ef4444; }
.anomaly-row .an-deviation.down { color: #10b981; }
.anomaly-row .an-prices { color: var(--text-muted); font-size: 0.78rem; }
.anomaly-row .an-date { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }

/* ---- Sample Section ---- */

.sample-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

/* ---- States ---- */

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* ---- PDF Upload / Review ---- */

.warnings-container {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.warning-item {
    color: #fbbf24;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.warning-item::before {
    content: "⚠";
    font-size: 1rem;
}

/* Editable Table */
.editable-table td { cursor: text; position: relative; }
.editable-table td:hover { background: rgba(255,255,255,0.04); }
.editable-table td input {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid var(--accent-primary);
    border-radius: 5px;
    font-size: 0.88rem;
    background: rgba(124,58,237,0.08);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}
.editable-table td.editing { padding: 0; }

/* Confidence Badges */
.confidence-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.confidence-high {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.confidence-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.confidence-low {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}

#pdf-review-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

#pdf-review-section h4 {
    margin-top: 22px;
    margin-bottom: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

#save-import-btn { margin-left: 10px; }

/* ---- Batch Import ---- */

.batch-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.batch-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
}

.batch-progress-fill {
    height: 100%;
    background: var(--grad-primary);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.batch-summary {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.batch-stat-card {
    flex: 1;
    min-width: 130px;
    padding: 16px 18px;
    border-radius: 10px;
    text-align: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.batch-stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    display: block;
    margin-bottom: 4px;
}

.batch-stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.batch-stat-total .stat-number  { color: var(--accent-primary); }
.batch-stat-success .stat-number { color: var(--accent-green); }
.batch-stat-failed .stat-number  { color: var(--accent-red); }

.batch-row-success { background: rgba(16, 185, 129, 0.06) !important; }
.batch-row-success:hover { background: rgba(16, 185, 129, 0.1) !important; }
.batch-row-fail { background: rgba(239, 68, 68, 0.07) !important; }
.batch-row-fail:hover { background: rgba(239, 68, 68, 0.12) !important; }
.batch-row-fail td { color: #fca5a5; }

.batch-error-detail {
    font-size: 0.8rem;
    color: var(--accent-amber);
    max-width: 280px;
    word-break: break-word;
}

.batch-warnings-toggle {
    font-size: 0.78rem;
    color: var(--accent-cyan);
    cursor: pointer;
    text-decoration: underline;
    margin-top: 4px;
    display: inline-block;
}

.batch-warnings-list {
    font-size: 0.78rem;
    color: #fbbf24;
    margin-top: 4px;
    padding-left: 14px;
}

/* ---- Paid Invoices Section ---- */

#finans-tab > .card > div > h3 {
    color: var(--accent-green) !important;
}

#paid-invoices-container table thead tr {
    background: rgba(16, 185, 129, 0.1) !important;
}

/* ---- Modals ---- */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-lg) !important;
    animation: modalSlideIn 0.25s ease !important;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-content h2 {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Delay Modal Buttons ---- */

.delay-option-btn {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-secondary) !important;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    padding: 10px 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.delay-option-btn:hover,
.delay-option-btn.active {
    background: rgba(124, 58, 237, 0.2) !important;
    border-color: var(--accent-primary) !important;
    color: #c4b5fd !important;
}

/* ---- Finans Pending table overrides ---- */

#invoices-table thead { background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.12)); }

/* ---- Settings ---- */

#logo-preview { max-width: 100%; max-height: 100%; }
#logo-placeholder { color: var(--text-muted) !important; font-size: 2rem; }

/* ---- Scrollbar ---- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---- Responsive ---- */

@media (max-width: 768px) {
    body { padding: 10px; }
    .container { border-radius: 12px; }
    header { padding: 24px 20px 20px; }
    header h1 { font-size: 1.6rem; }
    .tab-content { padding: 20px; }
    .card { padding: 18px; }
    .btn { padding: 9px 16px; font-size: 0.85rem; }
    .form-group { flex-direction: column; align-items: stretch; }
    .form-group label { min-width: unset; }
}

/* ---- Misc ---- */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

small { color: var(--text-muted); font-size: 0.78rem; }

/* Manual entry modal table header */
#manual-items-table thead tr {
    background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(6,182,212,0.2)) !important;
}

/* Override inline white backgrounds on modals */
[style*="background-color: #fefefe"],
[style*="background-color: white"],
[style*="background: white"] {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
}

/* Inline style overrides for stat cards */
[style*="background: #fff"],
[style*="background:#fff"] {
    background: var(--glass-bg) !important;
}

/* Product search results dropdown */
.product-search-results {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
}

.search-result-item:hover {
    background: rgba(124,58,237,0.15) !important;
}

/* FullCalendar dark override */
.fc {
    --fc-bg-event-opacity: 0.3;
    --fc-border-color: var(--glass-border);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--bg-elevated);
    --fc-list-event-hover-bg-color: rgba(255,255,255,0.04);
    --fc-today-bg-color: rgba(124, 58, 237, 0.08);
    color: var(--text-primary);
}

.fc-toolbar-title { color: var(--text-primary) !important; font-weight: 700 !important; }
.fc-button { background: rgba(255,255,255,0.06) !important; border: 1px solid var(--glass-border) !important; color: var(--text-secondary) !important; border-radius: 6px !important; font-family: 'Inter', sans-serif !important; }
.fc-button:hover { background: rgba(124,58,237,0.2) !important; color: var(--text-primary) !important; }
.fc-button-primary.fc-button-active { background: var(--accent-primary) !important; }
.fc-col-header-cell, .fc-daygrid-day-number { color: var(--text-secondary) !important; }
.fc-event { border-radius: 4px !important; }

/* ==========================================
   LAYOUT NORMALIZATION
   ========================================== */

/* All tab content sections get same width treatment */
.tab-content > .card,
.tab-content > div > .card {
    width: 100%;
    box-sizing: border-box;
}

/* Calendar tab — constrain to container width */
#calendar-tab .card {
    width: 100%;
    overflow: hidden;
}

#calendar {
    width: 100%;
    max-width: 100%;
    height: 680px !important;
    overflow: hidden;
}

/* Tables always fill their container */
.table-container {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
}

table {
    min-width: 600px; /* prevents collapse, enables scroll */
    width: 100%;
}

/* Analytics charts — responsive 2-col on wide, 1-col on narrow */
.analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    width: 100%;
}

@media (max-width: 900px) {
    .analytics-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Header stat cards — full width row */
#dashboard-stats {
    display: flex;
    gap: 14px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

/* Settings tab — consistent card widths */
#settings-tab .card {
    width: 100%;
}

/* Finans tab header th — don't overflow */
#invoices-table th,
#invoices-table td {
    white-space: nowrap;
}

/* Body responsive padding */
@media (max-width: 768px) {
    body { padding: 8px; }
    .tab-content { padding: 20px 16px; }
    header { padding: 24px 20px 20px; }
}

/* Paid invoices table inline style override */
#paid-invoices-body tr td {
    white-space: nowrap;
    font-size: 0.84rem;
}

/* Input shouldn't grow beyond its container */
.input {
    max-width: 100%;
    box-sizing: border-box;
}

/* Supplier management table */
#suppliers-table {
    width: 100%;
}

/* Fix inline max-width on calendar */
#calendar-tab .card > div[style*="max-width"],
#calendar-tab .card > div[style*="height"] {
    max-width: 100% !important;
}
/* Fire Takibi - KPI Cards */
.stat-card-sm { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 14px 16px; }
.stat-card-sm .label { font-size: 0.75rem; color: #8b949e; margin-bottom: 6px; }
.stat-card-sm .value { font-size: 1.05rem; font-weight: 600; color: #c9d1d9; }

/* ============================================================
   MOBİL RESPONSIVE — 768px ve altı
   ============================================================ */
@media (max-width: 768px) {

    /* ── Genel ── */
    body { padding: 0; font-size: 15px; }
    .container { border-radius: 0; min-height: 100dvh; }

    /* ── Header ── */
    header {
        padding: 16px 14px 12px;
        position: relative;
    }
    header h1 { font-size: 1.15rem; line-height: 1.3; }
    header .subtitle { font-size: 0.78rem; }
    #header-logout-btn {
        position: absolute;
        top: 12px; right: 12px;
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* ── Dashboard istatistik kartları ── */
    #dashboard-stats {
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
    }
    #dashboard-stats .stat-card {
        min-width: unset !important;
        padding: 10px 14px !important;
    }
    #dashboard-stats .stat-card > div:last-child {
        font-size: 1.1rem !important;
    }

    /* ── Tab bar: yatay kaydırma, daha küçük ── */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
    }
    .tab-btn {
        flex: 0 0 auto;
        min-width: unset;
        padding: 11px 12px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* ── Tab içeriği ── */
    .tab-content { padding: 12px 10px; }
    .card { padding: 14px 12px; }
    .card h2 { font-size: 1rem; }

    /* ── Tüm tablolar: yatay kaydırma zorunlu ── */
    .table-wrapper,
    .table-responsive,
    .card > .table,
    .tab-content > .table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }
    /* Inline tablo sarmalayıcılar için de genel kural */
    div[style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

    /* ── Tablo hücreleri ── */
    .table th, .table td {
        padding: 10px 8px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    /* ── Butonlar: dokunma alanı ── */
    .btn {
        min-height: 40px;
        padding: 9px 14px;
        font-size: 0.85rem;
    }
    .btn-small, .btn-sm {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    /* ── Form elemanları ── */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="password"],
    input[type="email"],
    select, textarea {
        min-height: 42px;
        font-size: 16px !important; /* iOS zoom'u engeller */
        padding: 8px 10px;
    }

    /* ── Yan yana form grupları tek kolona ── */
    .form-group { flex-direction: column; align-items: stretch; gap: 6px; }
    .form-group label { min-width: unset; font-size: 0.8rem; }

    /* ── Flex satır grupları mobilde dikey ── */
    .flex-row-mobile { flex-direction: column !important; }

    /* ── Upload / İçe Aktar ekranı ── */
    .upload-area {
        padding: 24px 16px;
        min-height: 120px;
    }
    .upload-area p { font-size: 0.85rem; }
    /* Dosya seçici butonu mobilde tam genişlik */
    .upload-area .btn,
    #upload-btn { width: 100%; margin-top: 10px; }

    /* ── Fatura onay ekranı (review) ── */
    #review-section .card { padding: 12px 10px; }
    #review-form-area table { font-size: 0.8rem; }

    /* ── Tedarikçi listesi: ikincil sütunları gizle ── */
    #suppliers-table th:nth-child(6),   /* Son Fatura */
    #suppliers-table td:nth-child(6),
    #suppliers-table th:nth-child(7),   /* Ort. Ödeme Süresi */
    #suppliers-table td:nth-child(7),
    #suppliers-table th:nth-child(8),   /* Son Fatura Tarihi */
    #suppliers-table td:nth-child(8) {
        display: none;
    }

    /* ── Tedarikçi detay modal ── */
    #supplier-detail-modal > div {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        max-height: 88vh !important;
        padding: 20px 14px !important;
    }
    #supplier-detail-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    #supplier-detail-stats > div {
        padding: 12px 10px !important;
    }
    #supplier-detail-stats > div > div:last-child {
        font-size: 1rem !important;
    }

    /* ── Fiyat Geçmişi tablosu: önemsiz sütunları gizle ── */
    /* Sütun sırası: Tarih | Tedarikçi | Ham Ürün Adı | Birim Fiyat | [Norm.] | [Efektif] | Miktar | PDF | İşlem */
    #price-table th:nth-child(3),   /* Ham Ürün Adı — mobilden gizle */
    #price-table td:nth-child(3) {
        display: none;
    }

    /* ── Finans ekranı: ödeme butonları tam genişlik ── */
    #finans-tab .btn-pay { width: 100%; margin-top: 6px; }

    /* ── Grafik canvas'larını mobilden gizle (tablo yeterli) ── */
    #analytics-tab canvas { display: none; }
    #price-chart { display: none; }          /* Fiyat geçmişi chart */
    #analytics-tab .analytics-charts-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── KPI kartları grid'i ── */
    .kpi-grid, [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── Inline geniş modal'lar (import review gibi) ── */
    .modal-content {
        width: 96% !important;
        max-width: 96% !important;
        margin: 4% auto !important;
        padding: 16px !important;
        max-height: 88vh !important;
        overflow-y: auto !important;
    }

    /* ── Fatura listesi (Ana Sayfa / Finans) ── */
    /* invoices-table: No | Tarih | Tedarikçi | Tutar | Durum | Vade | Ödeme Tar. | Yöntem | PDF | İşlem */
    #invoices-table th:nth-child(8),  /* Ödeme Yöntemi */
    #invoices-table td:nth-child(8) { display: none; }

    /* ── Takvim sekmesi ── */
    #calendar { height: 480px !important; }
    .fc-toolbar { flex-wrap: wrap; gap: 6px; }
    .fc-toolbar-title { font-size: 0.95rem !important; }

    /* ── Eşleştirme sekmesi ── */
    #matching-tab .card > div[style*="display:flex"] {
        flex-direction: column;
    }

    /* ── Genel yardımcı: overflow-x zorunlu ── */
    [class*="-table"], [id*="-table"] {
        overflow-x: auto;
        display: block;
    }
}

/* ── Çok küçük ekranlar (iPhone SE, 375px) ── */
@media (max-width: 400px) {
    .tab-btn { padding: 10px 9px; font-size: 0.72rem; }
    header h1 { font-size: 1rem; }
    .card { padding: 12px 10px; }
    #supplier-detail-stats {
        grid-template-columns: 1fr 1fr !important;
    }
}
