/**
 * ParçacımTR Kasa Defteri - Profesyonel Otomotiv Tema Stilleri & Mobil Uyumluluk
 */

:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --sidebar-bg: #1e2229;
    --sidebar-hover: #2b303b;
    --card-border: #e2e8f0;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --bottom-nav-height: 62px;
}

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

body {
    font-family: var(--font-sans);
    color: #1e293b;
    font-size: 0.925rem;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ana Düzen ve Taşıyıcılar (Yatay Taşmayı Önle) */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

#content {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    flex-grow: 1;
    overflow-x: hidden;
}

/* Sidebar Tasarımı (Masaüstü) */
#sidebar {
    background-color: var(--sidebar-bg) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), left 0.25s ease-in-out;
    width: 260px;
    flex-shrink: 0;
}

#sidebar .nav-link {
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

#sidebar .nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

#sidebar .nav-link.active {
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
}

#sidebar .nav-header {
    letter-spacing: 0.05em;
    font-size: 0.72rem;
}

/* Kartlar ve Tablolar */
.card {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--card-border);
}

.table th {
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #475569;
    background-color: #f8fafc;
    border-bottom-width: 1px;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.smaller {
    font-size: 0.75rem;
}

.money-badge-positive {
    background-color: #ecfdf5;
    color: #065f46;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.money-badge-negative {
    background-color: #fef2f2;
    color: #991b1b;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Tabloların Akıcı Dokunmatik Kaydırılması */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

/* Öneri / Otomatik Tamamlama Kutusu */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.autocomplete-item {
    padding: 10px 14px;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.autocomplete-item:hover, .autocomplete-item.active {
    background-color: #eff6ff;
    color: #1d4ed8;
}

/* ========================================================
 * MOBİL VE TABLET DUYARLILIK SİSTEMİ (@media max-width: 768px)
 * ======================================================== */
@media (max-width: 768px) {
    body {
        font-size: 0.88rem;
        /* Altta sabit gezinme çubuğu (Bottom Nav) için boşluk bırak */
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 12px) !important;
    }

    /* Mobilde sayfa yan boşluklarını optimize et (daha geniş ekran alanı) */
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .card {
        border-radius: 8px;
        margin-bottom: 0.75rem;
    }

    .card-body {
        padding: 0.85rem !important;
    }

    .card-header {
        padding: 0.75rem 0.85rem !important;
    }

    /* Başlık ve Tipografi Küçültmeleri */
    h4, .h4 {
        font-size: 1.15rem;
    }
    h5, .h5 {
        font-size: 1.05rem;
    }
    h6, .h6 {
        font-size: 0.925rem;
    }
    .fs-4 {
        font-size: 1.25rem !important;
    }
    .fs-5 {
        font-size: 1.1rem !important;
    }

    /* Mobil Offcanvas Sidebar (Drawer) */
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 290px;
        max-width: 84vw;
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1060;
        transform: translateX(-100%);
        box-shadow: none;
    }

    #sidebar.show {
        transform: translateX(0);
        box-shadow: 6px 0 25px rgba(0, 0, 0, 0.45);
    }

    /* Karartma Arka Planı (Backdrop) */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background-color: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 1055;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    /* Mobil Üst Bar (Topbar) */
    header.navbar {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        min-height: 54px;
    }

    #sidebarToggle {
        width: 38px;
        height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    /* iOS & Android Auto-Zoom Önleme ve Kolay Dokunma (Min 16px) */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="number"],
    input[type="datetime-local"],
    input[type="date"],
    input[type="tel"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
        border-radius: 8px;
    }

    .form-control-sm,
    .form-select-sm {
        min-height: 38px;
        font-size: 15px !important;
    }

    .input-group-text {
        min-height: 44px;
        font-size: 15px;
    }

    /* Dokunmatik Buton Ergonomisi */
    .btn {
        min-height: 42px;
        font-size: 0.88rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        font-weight: 500;
    }

    .btn-sm {
        min-height: 32px;
        font-size: 0.78rem;
        padding: 0.25rem 0.5rem;
    }

    /* Kart İçi Küçük Rozet ve Butonlar */
    .card .btn-sm {
        min-height: 28px;
        font-size: 0.72rem;
        padding: 0.15rem 0.45rem;
        border-radius: 6px;
    }

    /* Dashboard İstatistik Kartları (Mobilde Tam Uyumlu) */
    .stat-amount {
        font-size: clamp(0.95rem, 3.8vw, 1.25rem) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.25;
    }

    .stat-amount-secondary {
        font-size: clamp(0.85rem, 3.4vw, 1.1rem) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.25;
    }

    .stat-card-mobile {
        min-height: 84px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Mobil Hızlı Eylem Kartları (Mobile Quick Action Grid) */
    .mobile-quick-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.35rem;
        width: 100%;
        margin-bottom: 0.85rem;
    }

    .mobile-quick-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0.15rem;
        border-radius: 10px;
        text-decoration: none;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        transition: transform 0.1s ease, background-color 0.1s ease;
        text-align: center;
        min-height: 68px;
    }

    .mobile-quick-btn.mobile-quick-highlight {
        background: #eff6ff;
        border-color: #bfdbfe;
    }

    .mobile-quick-btn:active {
        transform: scale(0.95);
        background-color: #f1f5f9;
    }

    .mobile-quick-btn i {
        font-size: 1.25rem;
        margin-bottom: 0.2rem;
        line-height: 1;
    }

    .mobile-quick-btn span {
        font-size: 0.68rem;
        font-weight: 600;
        color: #334155;
        line-height: 1.1;
        white-space: nowrap;
    }

    /* Mobil Finansal Hareketler Akışı (Banking List View) */
    .mobile-tx-list {
        display: flex;
        flex-direction: column;
        background: #ffffff;
    }

    .mobile-tx-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0.85rem;
        border-bottom: 1px solid #f1f5f9;
        text-decoration: none;
        color: inherit;
        transition: background-color 0.15s ease;
    }

    .mobile-tx-item:last-child {
        border-bottom: none;
    }

    .mobile-tx-item:active {
        background-color: #f8fafc;
    }

    .mobile-tx-icon {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        margin-right: 0.65rem;
        font-size: 1.15rem;
    }

    .mobile-tx-info {
        flex-grow: 1;
        min-width: 0;
        margin-right: 0.5rem;
    }

    .mobile-tx-title {
        font-weight: 600;
        font-size: 0.825rem;
        color: #0f172a;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.25;
        margin-bottom: 0.15rem;
    }

    .mobile-tx-meta {
        font-size: 0.7rem;
        color: #64748b;
        display: flex;
        align-items: center;
        gap: 0.35rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-tx-amount-box {
        text-align: right;
        flex-shrink: 0;
    }

    .mobile-tx-amount {
        font-weight: 700;
        font-family: monospace, sans-serif;
        font-size: 0.88rem;
        line-height: 1.2;
        white-space: nowrap;
    }

    /* Form Aksiyon Butonları */
    .form-actions-mobile {
        display: flex;
        flex-direction: column-reverse;
        gap: 0.5rem;
        width: 100%;
        margin-top: 1rem;
    }

    .form-actions-mobile .btn {
        width: 100%;
    }

    /* Tabloların Mobilde Kompaktlaşması */
    .table {
        font-size: 0.8rem;
    }

    .table th, .table td {
        padding: 0.5rem 0.45rem;
    }

    .table th {
        font-size: 0.72rem;
        white-space: nowrap;
    }

    /* Para ve Tarih Değerlerinin Tek Satırda Kalması */
    .table .font-monospace,
    .table td.text-nowrap,
    .table .badge,
    .table .badge-money {
        white-space: nowrap !important;
    }

    /* Tablo İçi Buton Grubu */
    .table-actions-nowrap {
        display: inline-flex;
        gap: 4px;
        white-space: nowrap;
        flex-wrap: nowrap;
    }

    /* Modal Pencere Düzeni */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 12px;
    }

    /* Filtreleme ve Arama Çubuğu */
    form.row.g-2 > div,
    form.row.g-3 > div {
        margin-bottom: 0.25rem;
    }

    /* Hızlı Aksiyon Butonları Grupları */
    .mobile-action-wrap {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    .mobile-action-wrap > * {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* ========================================================
 * MOBİL SABİT ALT GEZİNME ÇUBUĞU (BOTTOM NAVIGATION BAR)
 * ======================================================== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1040;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 0;
    transition: color 0.15s ease, transform 0.1s ease;
    border: none;
    background: transparent;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
    line-height: 1;
}

.mobile-bottom-nav-item.active {
    color: #0d6efd;
    font-weight: 700;
}

.mobile-bottom-nav-item.action-income {
    color: #198754;
}

.mobile-bottom-nav-item.action-expense {
    color: #dc3545;
}

.mobile-bottom-nav-item:active {
    transform: scale(0.92);
    opacity: 0.8;
}

/* Dokunmatik Ekranlarda Hafif Dokunma Efekti */
@media (hover: none) and (pointer: coarse) {
    .btn:active,
    .nav-link:active,
    .dropdown-item:active {
        opacity: 0.85;
        transform: scale(0.98);
    }
}
