/* Ayfa Plus Finance - Light Theme Mobile-First */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #0ea5e9;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --hover: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

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

/* ==================== Layout ==================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (desktop) */
.sidebar {
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.sidebar-menu {
    list-style: none;
    padding: 12px;
    margin: 0;
}

.sidebar-menu li { margin-bottom: 2px; }

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-menu a:hover {
    background: var(--hover);
    color: var(--text);
    text-decoration: none;
}

.sidebar-menu a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-menu .menu-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.sidebar-section {
    padding: 12px 14px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
}

/* Topbar */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 13px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.page-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Mobile menu button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    padding: 4px 8px;
    color: var(--text);
    cursor: pointer;
}

/* Mobile bottom nav */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 1020;
    box-shadow: 0 -2px 10px rgb(0 0 0 / 0.04);
}

.bottom-nav-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin: 0;
    padding: 0 8px;
    list-style: none;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
}

.bottom-nav a:hover, .bottom-nav a.active {
    color: var(--primary);
    text-decoration: none;
}

.bottom-nav .icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav .add-btn {
    background: var(--primary);
    color: white !important;
    margin: -16px 4px 0;
    padding: 10px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    justify-content: center;
    box-shadow: 0 4px 12px rgb(79 70 229 / 0.4);
}

.bottom-nav .add-btn .icon { font-size: 26px; }

/* Mobile responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding-bottom: 80px;
    }
    .menu-toggle {
        display: inline-block;
    }
    .bottom-nav {
        display: block;
    }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgb(0 0 0 / 0.4);
        z-index: 1025;
    }
    .sidebar-backdrop.show { display: block; }
    .page-container { padding: 14px; }
}

/* ==================== Cards ==================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    background: transparent;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 18px; }

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow); }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-card.gelir .stat-value { color: var(--success); }
.stat-card.gider .stat-value { color: var(--danger); }
.stat-card.net.pos .stat-value { color: var(--success); }
.stat-card.net.neg .stat-value { color: var(--danger); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-card.gelir .stat-icon { background: var(--success-light); }
.stat-card.gider .stat-icon { background: var(--danger-light); }
.stat-card.net .stat-icon { background: var(--primary-light); }
.stat-card.islem .stat-icon { background: var(--warning-light); }

/* ==================== Forms ==================== */
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
    transition: all 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(79 70 229 / 0.1);
    outline: none;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}
.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: var(--hover);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--hover);
    color: var(--text);
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* Large tap targets for mobile */
.btn-mobile {
    padding: 14px 20px;
    font-size: 15px;
    border-radius: var(--radius);
}

/* ==================== Tables ==================== */
.table {
    width: 100%;
    color: var(--text);
    vertical-align: middle;
}

.table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    background: var(--bg);
}

.table td {
    padding: 14px;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background: var(--hover);
}

/* ==================== Badges ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-secondary { background: var(--border-light); color: var(--text-muted); }

.badge-tip-MUSTERI { background: #dbeafe; color: #1e40af; }
.badge-tip-TEDARIKCI { background: #fed7aa; color: #9a3412; }
.badge-tip-PERSONEL { background: #ddd6fe; color: #5b21b6; }
.badge-tip-DIGER { background: var(--border-light); color: var(--text-muted); }

/* ==================== Hesap Tree (TDHP) ==================== */
.hesap-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hesap-tree .hesap-item {
    border-bottom: 1px solid var(--border-light);
}

.hesap-tree .hesap-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.hesap-tree .hesap-row:hover {
    background: var(--hover);
}

.hesap-tree .expand-toggle {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: var(--text-muted);
    margin-right: 4px;
    flex-shrink: 0;
    font-size: 11px;
    transition: transform 0.2s;
}

.hesap-tree .expand-toggle.open { transform: rotate(90deg); }

.hesap-tree .no-toggle {
    width: 22px;
    margin-right: 4px;
}

.hesap-tree .hesap-kod {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-weight: 600;
    color: var(--primary);
    margin-right: 12px;
    min-width: 70px;
    font-size: 13px;
}

.hesap-tree .hesap-ad {
    flex: 1;
    font-size: 14px;
}

.hesap-tree .hesap-bakiye {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-weight: 600;
    font-size: 13px;
    margin-left: 10px;
    white-space: nowrap;
}

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

.hesap-tree .children {
    display: none;
}
.hesap-tree .hesap-item.open > .children {
    display: block;
}

.hesap-tree .seviye-1 { background: var(--primary-light); font-weight: 700; }
.hesap-tree .seviye-1 .hesap-kod { color: var(--primary-dark); }
.hesap-tree .seviye-2 { padding-left: 26px; background: #fafafa; font-weight: 600; }
.hesap-tree .seviye-3 { padding-left: 50px; }
.hesap-tree .seviye-4 { padding-left: 74px; color: var(--text-muted); font-size: 13px; }
.hesap-tree .seviye-5 { padding-left: 98px; color: var(--text-muted); font-size: 13px; }

/* ==================== Islem Card (Transaction Card) ==================== */
.islem-card {
    display: flex;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    transition: background 0.1s;
    cursor: pointer;
}

.islem-card:hover { background: var(--hover); }

.islem-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.islem-icon.gelir { background: var(--success-light); color: var(--success); }
.islem-icon.gider { background: var(--danger-light); color: var(--danger); }
.islem-icon.virman { background: #dbeafe; color: var(--info); }
.islem-icon.mahsup { background: var(--warning-light); color: var(--warning); }

.islem-body {
    flex: 1;
    min-width: 0;
}

.islem-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.islem-meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.islem-amount {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    text-align: right;
}

.islem-amount.gelir { color: var(--success); }
.islem-amount.gider { color: var(--danger); }

/* ==================== Quick Action Buttons (Islem Giris) ==================== */
.tip-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.tip-btn {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}

.tip-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tip-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.tip-btn .tip-icon {
    font-size: 26px;
    line-height: 1;
}

/* ==================== Modal ==================== */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 16px 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
}

.modal-body { padding: 20px; }
.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 14px 20px;
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.empty-state-desc {
    font-size: 13px;
}

/* ==================== Utilities ==================== */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }

.bg-light { background: var(--bg) !important; }
.bg-white { background: var(--card-bg) !important; }

.money {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-weight: 600;
}

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

.rounded-pill { border-radius: 999px; }

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f3e8ff 50%, #fae8ff 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.1);
    padding: 36px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    margin: 0 auto 16px;
    box-shadow: 0 10px 25px -5px rgb(79 70 229 / 0.4);
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-size: 13px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-color: #fecaca;
}
.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-color: #a7f3d0;
}
.alert-info {
    background: #e0f2fe;
    color: #0c4a6e;
    border-color: #bae6fd;
}

/* Select2 override (eger kullanirsak) */
.select2-container--default .select2-selection--single {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    height: 42px;
    padding: 6px 10px;
}

/* Autocomplete dropdown */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: var(--shadow);
    display: none;
}
.autocomplete-list.show { display: block; }
.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
}
.autocomplete-item:hover, .autocomplete-item.active {
    background: var(--primary-light);
}
.autocomplete-item .item-title { font-weight: 500; }
.autocomplete-item .item-meta { font-size: 12px; color: var(--text-muted); }
.autocomplete-item.create-new { color: var(--primary); font-weight: 600; }

/* Mobile tweaks */
@media (max-width: 576px) {
    .page-container { padding: 12px; }
    .card-body { padding: 14px; }
    .stat-value { font-size: 20px; }
    .btn { padding: 12px 18px; }
    .tip-buttons { grid-template-columns: repeat(2, 1fr); }
    .topbar { padding: 10px 14px; }
    .topbar-title { font-size: 16px; }
}
