@import "./auth-theme.css";
@import "./header.css";

:root {
    /* Colors - Earthy yet Vibrant and Clean */
    --clr-vibrant: #f59e0b;
    --clr-vibrant-dark: #d97706;
    --clr-vibrant-light: #fef3c7;
    
    --clr-earth-800: #422006;
    --clr-earth-900: #2e1402;
    --clr-earth-100: #ffedd5;
    --clr-earth-600: #9a3412;
    
    --clr-lush-700: #15803d;
    --clr-lush-500: #22c55e;
    --clr-lush-100: #dcfce7;
    --clr-lush-900: #14532d;
    
    --clr-success: #16a34a;
    --clr-danger: #dc2626;

    --clr-bg: #f8fafc;
    --clr-surface: #ffffff;
    
    --clr-txt-main: #0f172a;
    --clr-txt-muted: #64748b;
    
    /* Typography - Big and Clean */
    --font-heading: system-ui, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
    
    /* Safearae */
    --safe-bottom: max(20px, env(safe-area-inset-bottom));
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-heading);
    background-color: var(--clr-bg);
    color: var(--clr-txt-main);
    line-height: 1.5;
    overflow: hidden;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
}

.hidden { display: none !important; }

/* LAYOUT SHELLS */
.app-shell, .auth-shell {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--clr-bg);
    z-index: 100;
}
.app-shell.is-full-height {
    z-index: 110;
}

/* AUTHENTICATION UI */
.auth-shell {
    background: linear-gradient(135deg, var(--clr-lush-900), var(--clr-lush-700));
}
.auth-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    color: white;
    text-align: center;
}
.auth-panel {
    background: var(--clr-surface);
    border-top-left-radius: 2rem;
    border-top-right-radius: 2rem;
    padding: 2rem;
    padding-bottom: calc(2rem + var(--safe-bottom));
    box-shadow: 0 -10px 25px rgba(0,0,0,0.2);
}
.panel-glass {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 1.5rem;
    padding: 2rem;
}

/* APP SHELL (Header + Scrollable Main + Bottom Nav) */
.app-header {
    background: var(--clr-surface);
    padding: 1rem 1.5rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    z-index: 50;
    position: relative;
}
.panel-lush {
    background: linear-gradient(135deg, var(--clr-lush-700), var(--clr-lush-900));
    color: white;
    border-bottom-left-radius: 1.5rem;
    border-bottom-right-radius: 1.5rem;
}
.app-header__top {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-body {
    position: relative;
    z-index: 10;
    scroll-behavior: smooth;
}
.pb-safe {
    padding-bottom: calc(90px + var(--safe-bottom));
}

/* VIEWS & SECTIONS */
.view {
    display: none !important;
    animation: fadeIn 0.3s ease-out;
}
.view.is-active {
    display: flex !important;
    flex-direction: column;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* TYPOGRAPHY */
.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}
.section-copy {
    font-size: 1.125rem;
    color: var(--clr-txt-muted);
}
.eyebrow {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--clr-lush-700);
    margin-bottom: 0.25rem;
}
.eyebrow--light { color: var(--clr-lush-100); }
.text-white { color: white !important; }
.text-success { color: var(--clr-success) !important; }
.text-danger { color: var(--clr-danger) !important; }
.text-vibrant { color: var(--clr-vibrant) !important; }
.text-earth-300 { color: #fdba74 !important; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.txt-lg { font-size: 1.125rem; line-height: 1.6; }

/* COMPONENTS */
.panel {
    background: var(--clr-surface);
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
}
.panel-vibrant {
    background: linear-gradient(135deg, var(--clr-vibrant), var(--clr-vibrant-dark));
    border: none;
    position: relative;
    overflow: hidden;
}
.panel-vibrant__deco {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 120px;
    height: 120px;
    opacity: 0.2;
    color: white;
}
.panel--card {
    border-left: 6px solid var(--clr-lush-500);
}
.shadow-sm { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06); }
.setup-container {
    margin: auto;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.brand-lockup__icon {
    width: 3rem; height: 3rem;
    background: var(--clr-lush-100);
    color: var(--clr-lush-700);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.brand-lockup__icon svg { width: 60%; height: 60%; }
.brand-lockup__icon--small { width: 2.5rem; height: 2.5rem; border-radius: 0.6rem; }
.brand-lockup__icon--large { width: 4.5rem; height: 4.5rem; border-radius: 1rem; }

/* FORMS & INPUTS */
.stack-md { display: flex; flex-direction: column; gap: 1rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1.5rem; }
.stack-xl { display: flex; flex-direction: column; gap: 2rem; }

.form-label {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--clr-txt-main);
}
.field {
    width: 100%;
    font-size: 1.25rem;
    padding: 1.125rem;
    border-radius: 1rem;
    border: 2px solid #cbd5e1;
    background: var(--clr-bg);
    color: var(--clr-txt-main);
    font-family: inherit;
    font-weight: 600;
    transition: box-shadow 0.2s, border-color 0.2s;
    appearance: none;
}
.field--textarea { resize: vertical; min-height: 100px; }
.field:focus {
    outline: none;
    border-color: var(--clr-lush-500);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}
.field--small {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
}

/* SPECIAL FORMS */
.segments {
    background: var(--clr-bg);
    padding: 0.35rem;
    border-radius: 1rem;
    border: 2px solid #cbd5e1;
}
.segment { position: relative; cursor: pointer; }
.segment__box {
    text-align: center;
    padding: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 0.75rem;
    color: var(--clr-txt-muted);
    transition: 0.2s all;
}
input.peer:checked + .segment__box {
    background: var(--clr-surface);
    color: var(--clr-txt-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* BUTTONS */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    padding: 1.125rem 1.5rem;
    border-radius: 1rem;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.btn-primary { background: var(--clr-lush-700); color: white; }
.btn-secondary { background: transparent; color: var(--clr-txt-main); border: 2px solid #cbd5e1; }
.btn-primary:active, .btn-secondary:active, .icon-button:active, .nav-btn:active { transform: scale(0.96); }
.full-width { width: 100%; }

.btn-primary--small {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
}

.icon-button {
    width: 3rem; height: 3rem;
    border-radius: 50%;
    border: none;
    background: var(--clr-bg);
    color: var(--clr-txt-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.icon-button svg { width: 1.5rem; height: 1.5rem; }
.icon-button--small { width: 2.5rem; height: 2.5rem; border-radius: 0.5rem; background: var(--clr-bg) }

.icon-sm { width: 1.25rem; height: 1.25rem; }

/* ALERTS & INFO */
.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    text-align: center;
}
.alert--danger { background: #fee2e2; color: var(--clr-danger); }
.alert--success { background: var(--clr-lush-100); color: var(--clr-success); }
.info-box {
    background: #e0f2fe; color: #0284c7;
    padding: 1rem; border-radius: 0.75rem;
    font-size: 1rem; text-align: center;
}

/* GRIDS */
.metric-grid { display: grid; gap: 1rem; }
.metric-grid--two { grid-template-columns: 1fr 1fr; }

.metric-card {
    background: var(--clr-surface);
    padding: 1.25rem;
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}
.metric-card::after {
    content:''; position: absolute; bottom:0; left:0; right:0; height: 6px;
}
.metric-card--lush::after { background: var(--clr-lush-500); }
.metric-card--earth::after { background: var(--clr-earth-600); }

.metric-card__icon {
    width: 3rem; height: 3rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.5rem;
    background: var(--clr-bg);
}
.metric-card--lush .metric-card__icon { color: var(--clr-lush-500); }
.metric-card--earth .metric-card__icon { color: var(--clr-earth-600); }
.metric-card__icon svg { width: 1.5rem; height: 1.5rem; }

.metric-card__value {
    font-size: 2.5rem; font-weight: 900; line-height: 1; color: var(--clr-txt-main);
}
.metric-card__label {
    font-size: 0.9rem; font-weight: 700; color: var(--clr-txt-muted); text-transform: uppercase; margin-top: 0.25rem;
}

/* FINANCE SUMMARY block */
.finance-summary-grid {
    display: flex; gap: 1rem; margin-top: 1rem;
}
.finance-block {
    flex: 1; padding: 1rem; border-radius: 1rem; display: flex; flex-direction: column; align-items: center;
}
.finance-block--income { background: var(--clr-lush-100); }
.finance-block--expense { background: #fee2e2; }
.finance-value { font-size: 1.5rem; font-weight: 900; }
.finance-net {
    margin-top: 1rem; display: flex; flex-direction: column; align-items: center;
    padding-top: 1rem; border-top: 2px dashed #e2e8f0;
}
.finance-value--large { font-size: 2.25rem; color: var(--clr-txt-main); }

/* LIST CARDS */
.list-card {
    background: var(--clr-surface);
    border-radius: 1.25rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.list-card__icon {
    width: 3rem; height: 3rem; border-radius: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--clr-bg);
}
.list-card__icon svg { width: 1.5rem; height: 1.5rem; color: var(--clr-txt-muted); }
.list-card__content { flex: 1; min-width: 0; }
.list-card__title { font-size: 1.25rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--clr-txt-main); line-height: 1.2; }
.list-card__subtitle { font-size: 0.9rem; font-weight: 600; color: var(--clr-txt-muted); margin-top: 0.25rem; display: flex; align-items: center; gap: 0.25rem;}
.list-card__action {
    background: transparent; border: none; color: #94a3b8; padding: 0.5rem; cursor: pointer;
}
.list-card__action:active { color: var(--clr-danger); transform: scale(0.9); }
.list-card__action svg { width: 1.5rem; height: 1.5rem; }

.badge-finance {
    font-weight: 900; font-size: 1.125rem; text-align: right; line-height: 1.1;
}

/* BOTTOM NAVIGATION */
.bottom-nav {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--clr-surface);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 1rem;
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid #e2e8f0;
    z-index: 80;
}
.nav-btn {
    background: transparent;
    border: none;
    color: var(--clr-txt-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    flex: 1;
    cursor: pointer;
}
.nav-btn svg { width: 1.75rem; height: 1.75rem; transition: transform 0.2s; }
.nav-btn span { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.nav-btn.is-active { color: var(--clr-lush-700); }
.nav-btn.is-active svg { fill: var(--clr-lush-100); transform: translateY(-2px); }

/* FAB BTN */
.nav-btn--fab {
    position: relative; top: -1.25rem;
}
.fab-inner {
    width: 3.5rem; height: 3.5rem;
    background: var(--clr-vibrant);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 15px rgba(245, 158, 11, 0.4);
    border: 4px solid var(--clr-bg);
}
.fab-inner svg { width: 2rem; height: 2rem; fill: none!important; }

/* MODALS */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-end; /* Slide from bottom mimicking native mobile */
    opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.is-active { opacity: 1; }
.modal-card {
    background: var(--clr-surface);
    width: 100%;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    padding: 1.5rem;
    padding-bottom: max(1.5rem, var(--safe-bottom));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
    display: none;
}
.modal-overlay.is-active .modal-card.is-active {
    display: block; transform: translateY(0);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1.5rem; font-weight: 800; }
.border-top-line { border-top: 1px solid #e2e8f0; padding-top: 1rem; }

/* UTILS */
.p-md { padding: 1.5rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-xl { margin-bottom: 2rem; }
.mt-xs { margin-top: 0.25rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.flex-1 { flex: 1; }
.overflow-auto { overflow-y: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.outline-none { border: none !important; }

/* TOASTS */
.toast-container {
    position: fixed; top: max(1rem, env(safe-area-inset-top)); left: 1rem; right: 1rem;
    z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;
}
.toast {
    background: var(--clr-txt-main); color: white;
    padding: 1rem 1.5rem; border-radius: 1rem;
    font-size: 1.125rem; font-weight: 700; text-align: center;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    animation: toastIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.toast--success { background: var(--clr-success); }
.toast--error { background: var(--clr-danger); }
.toast.is-leaving { animation: toastOut 0.3s forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }
