/* ============================================================
   Karacasu Ziraat Odası - Ön Muhasebe Sistemi
   Modern, responsive (mobil öncelikli) tasarım
   ============================================================ */

:root {
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #dcfce7;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.05);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ============================================================
   ÜST NAVİGASYON
   ============================================================ */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-dark);
}
.brand-icon { font-size: 1.5rem; }
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.topbar-link {
    color: var(--text);
    font-weight: 500;
}
.topbar-link:hover { color: var(--primary); text-decoration: none; }
.user-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 600;
}

/* ============================================================
   KAPSAYICI
   ============================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 1.6rem; color: var(--text); }
.muted { color: var(--text-muted); font-size: .9rem; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   BUTONLAR
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

/* ============================================================
   BAKİYE KARTLARI
   ============================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--border);
}
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}
.card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.card-value { font-size: 1.25rem; font-weight: 700; word-break: break-all; }

.card-income { border-left-color: var(--success); }
.card-income .card-icon { background: var(--success-light); color: var(--success); }
.card-expense { border-left-color: var(--danger); }
.card-expense .card-icon { background: var(--danger-light); color: var(--danger); }
.card-net { border-left-color: var(--accent); }
.card-net .card-icon { background: #dbeafe; color: var(--accent); }
.card-prev { border-left-color: var(--warning); }
.card-prev .card-icon { background: var(--warning-light); color: var(--warning); }
.card-final { border-left-color: var(--primary); }
.card-final .card-icon { background: var(--primary-light); color: var(--primary); }

.pos { color: var(--success); }
.neg { color: var(--danger); }

/* ============================================================
   PANEL / TABLO
   ============================================================ */
.panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h2 { font-size: 1.1rem; }
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.table th, .table td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr.clickable-row:hover { background: #ecfdf5; cursor: pointer; }
.text-right { text-align: right; }

/* ============================================================
   FORM ELEMANLARI
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: .88rem;
}
.input, input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    background: var(--surface);
}
.input:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}
select { cursor: pointer; }

/* ============================================================
   GİRİŞ SAYFASI
   ============================================================ */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #064e3b 0%, #16a34a 50%, #4ade80 100%);
    padding: 20px;
}
.auth-container { width: 100%; max-width: 420px; }
.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-logo svg { width: 32px; height: 32px; }
.auth-card h1 {
    text-align: center;
    font-size: 1.3rem;
    color: var(--text);
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: .9rem;
}
.auth-form { margin-bottom: 20px; }
.auth-hint {
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
}

/* ============================================================
   ALERT
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .9rem;
}
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: var(--success-dark); border: 1px solid #bbf7d0; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-backdrop[hidden] {
    display: none;
}
.modal {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 1.15rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.step-header { margin-bottom: 16px; }
.step-header h3 { font-size: 1.05rem; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}
.step-dot {
    height: 6px;
    flex: 1;
    background: var(--border);
    border-radius: 3px;
    transition: background .2s;
}
.step-dot.active { background: var(--primary); }
.step-dot.dot-income.active { background: var(--success); }
.step-dot.dot-expense.active { background: var(--danger); }

/* Gelir / Gider rozeti */
.kind-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
}
.kind-badge.income {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}
.kind-badge.expense {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* Modal kenarlık rengi */
.modal-income { border: 2px solid var(--success); border-top: none; }
.modal-expense { border: 2px solid var(--danger); border-top: none; }
.modal-income .modal-header { background: var(--success-light); }
.modal-expense .modal-header { background: var(--danger-light); }

/* Dinamik satırlar */
.dyn-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.dyn-row {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 10px;
    align-items: center;
}
.dyn-row .amount-input { width: 140px; }
.step-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 1rem;
}
.step-total-val { color: var(--primary-dark); font-size: 1.1rem; }

/* ============================================================
   RAPOR SAYFASI
   ============================================================ */
.filters {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.filter-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-row .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.summary-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    text-align: center;
}
.summary-card .label { font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; }
.summary-card .value { font-size: 1.3rem; font-weight: 700; }

/* ============================================================
   BASKI / PDF
   ============================================================ */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .container { padding: 0; max-width: 100%; }
    .panel, .card, .summary-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    .table { font-size: 11px; }
    .table th, .table td { padding: 6px 10px; }
}

/* ============================================================
   MOBİL
   ============================================================ */
@media (max-width: 640px) {
    .topbar-inner { padding: 12px 16px; }
    .container { padding: 16px; }
    .dyn-row {
        grid-template-columns: 1fr;
    }
    .dyn-row .amount-input { width: 100%; }
    .card { padding: 16px; }
    .card-value { font-size: 1.1rem; }
    .page-header h1 { font-size: 1.3rem; }
    .filter-row { flex-direction: column; }
    .filter-row .form-group { width: 100%; }
}
