/* assets/css/app.css — Nakit Akışı Yöneticisi */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --brand: #00d2ff;
    --brand2: #3a7bd5;
    --bg: #0f0f1a;
    --bg2: #1a1a2e;
    --bg3: #16213e;
    --card: #1e2038;
    --border: rgba(255,255,255,.08);
    --text: #e0e0f0;
    --text-muted: #8888aa;
    --sidebar-w: 220px;
    --nav-h: 56px;
    --bottom-nav-h: 62px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    /* iOS home indicator clearance — 34px fallback for Face ID phones */
    padding-bottom: calc(var(--bottom-nav-h) + max(env(safe-area-inset-bottom, 34px), 34px));
}

/* ===== NAVBAR ===== */
#main-nav {
    background: rgba(15,15,26,.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1030;
    /*
     * iPhone notch / Dynamic Island / status bar:
     * max(env(), fallback) guarantees clearance even when
     * env(safe-area-inset-top) = 0 in non-PWA Safari.
     * 44px = safe default for Face ID phones, 20px for SE/older
     */
    padding-top: max(env(safe-area-inset-top, 44px), 44px);
    padding-left:  env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    min-height: calc(var(--nav-h) + max(env(safe-area-inset-top, 44px), 44px));
}
/* Keep inner items vertically centred within the content area below the inset */
#main-nav .container-fluid {
    min-height: var(--nav-h);
    display: flex;
    align-items: center;
}

.brand-icon {
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-text {
    font-weight: 800;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.month-nav { gap: .25rem; }

.btn-nav-month {
    background: rgba(255,255,255,.07);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: .25rem .5rem;
    transition: background .2s;
}
.btn-nav-month:hover { background: rgba(0,210,255,.15); color: var(--brand); }

.month-label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    min-width: 110px;
    text-align: center;
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: calc(100vh - var(--nav-h) - env(safe-area-inset-top, 0px));
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    position: sticky;
    top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
    height: calc(100vh - var(--nav-h) - env(safe-area-inset-top, 0px));
    overflow-y: auto;
    flex-shrink: 0;
    padding-left: env(safe-area-inset-left, 0px);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .85rem;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    transition: all .2s;
}
.sidebar-link i { font-size: 1rem; }
.sidebar-link:hover { background: rgba(0,210,255,.08); color: var(--brand); }
.sidebar-link.active { background: linear-gradient(135deg, rgba(0,210,255,.15), rgba(58,123,213,.15)); color: var(--brand); font-weight: 600; }

/* ===== MAIN ===== */
.app-main { flex: 1; min-width: 0; }

/* ===== CARDS ===== */
.app-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.app-card .card-header {
    background: rgba(255,255,255,.03);
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    padding: .85rem 1.25rem;
}

/* ===== SUMMARY CARDS ===== */
.summary-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.summary-icon { font-size: 1.5rem; margin-bottom: .5rem; opacity: .7; }
.summary-label { font-size: .75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; }
.summary-value { font-size: 1.4rem; font-weight: 800; }
.summary-sub { font-size: .68rem; color: var(--text-muted); margin-top: .2rem; opacity: .7; }

/* ===== DAILY CASHFLOW TABLE ===== */
.cashflow-table th { background: rgba(255,255,255,.04); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-color: var(--border); }
.cashflow-table td { border-color: var(--border); font-size: .875rem; vertical-align: middle; }
.cashflow-table .today-row { background: rgba(0,210,255,.06) !important; }
.cashflow-table .flow-negative { background: rgba(220,53,69,.04); }

/* ===== QUICK NAV CARDS ===== */
.quick-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    font-size: .875rem;
    font-weight: 500;
    transition: all .25s;
}
.quick-nav-card:hover { border-color: var(--brand); background: rgba(0,210,255,.08); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,210,255,.1); color: var(--brand); }

/* ===== BUTTONS ===== */
.btn-brand {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    transition: opacity .2s, transform .1s;
}
.btn-brand:hover { opacity: .9; color: #fff; transform: translateY(-1px); }
.btn-brand:active { transform: scale(.97); }
.text-brand { color: var(--brand) !important; }

/* ===== FORMS ===== */
.form-control, .form-select, .input-group-text {
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
}
.form-control:focus, .form-select:focus {
    background: rgba(255,255,255,.07);
    border-color: var(--brand);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(0,210,255,.15);
}
.form-control::placeholder { color: var(--text-muted); }
.input-group-text { color: var(--text-muted); border-right: none; }
.input-group .form-control { border-left: none; }
.form-label { font-size: .8rem; font-weight: 500; color: var(--text-muted); }

/* ===== TABLES ===== */
.table { color: var(--text); }
.table > :not(caption) > * > * {
    background-color: transparent;
    border-color: var(--border);
}
.table-hover tbody tr:hover > * {
    background-color: rgba(255,255,255,.03);
}

/* ===== MODALS ===== */
.app-modal {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
}
.app-modal .modal-header {
    border-bottom: 1px solid var(--border);
}
.app-modal .modal-footer {
    border-top: 1px solid var(--border);
}
.btn-close { filter: invert(1); }

/* ===== DAY BADGE ===== */
.day-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255,255,255,.05);
}
.day-badge-today {
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    color: #fff;
    box-shadow: 0 0 12px rgba(0,210,255,.4);
}

/* ===== BOTTOM MOBILE NAV ===== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15,15,26,.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 1030;
    justify-content: space-around;
    align-items: center;
    /* nav items sit above home indicator */
    padding-top: .5rem;
    padding-bottom: max(env(safe-area-inset-bottom, 34px), 34px);
    padding-left:  env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .65rem;
    font-weight: 500;
    padding: .4rem .6rem;
    border-radius: 10px;
    transition: all .2s;
    flex: 1;
}
.mobile-nav-item i { font-size: 1.2rem; }
.mobile-nav-item.active, .mobile-nav-item:hover { color: var(--brand); }
.mobile-nav-item.active i { filter: drop-shadow(0 0 6px var(--brand)); }

/* ===== AUTH PAGES ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(ellipse at top left, rgba(0,210,255,.08) 0%, transparent 60%),
                radial-gradient(ellipse at bottom right, rgba(58,123,213,.08) 0%, transparent 60%),
                var(--bg);
}
.auth-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.auth-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, rgba(0,210,255,.15), rgba(58,123,213,.15));
    border: 1px solid rgba(0,210,255,.3);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    color: var(--brand);
    margin: 0 auto 1rem;
}
.auth-title {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .25rem;
}

/* ===== PAGE HEADER ===== */
.page-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

/* ===== ALERTS ===== */
.alert { border-radius: 12px; border: 1px solid; }
.alert-success { background: rgba(25,135,84,.1); border-color: rgba(25,135,84,.3); color: #75d89e; }
.alert-danger  { background: rgba(220,53,69,.1);  border-color: rgba(220,53,69,.3);  color: #f0808f; }

/* ===== BADGES ===== */
.badge { border-radius: 6px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.app-card, .summary-card, .quick-nav-card { animation: fadeInUp .3s ease both; }
.app-card:nth-child(2) { animation-delay: .05s; }
.app-card:nth-child(3) { animation-delay: .1s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    /* Mobile: safe-area fallback with 44px for iPhone status bar */
    body {
        padding-bottom: calc(var(--bottom-nav-h) + max(env(safe-area-inset-bottom, 34px), 34px));
    }
    .month-label { min-width: 90px; font-size: .8rem; }
}
@media (min-width: 992px) {
    /* Desktop / tablet: no extra bottom padding, reset top nav to zero */
    body { padding-bottom: 0; }
    #main-nav {
        padding-top: 0;
        min-height: var(--nav-h);
    }
}
