/* ========================================
   Daily Business Tracker — Custom Styles
   Design: Street-food hustle aesthetic —
   warm saffron + deep charcoal palette,
   Space Grotesk headings, Inter body.
   ======================================== */

/* ---------- Design Tokens ---------- */
:root {
    --saffron:        #F59E0B;
    --saffron-dark:   #D97706;
    --saffron-light:  #FEF3C7;
    --charcoal:       #1C1F2E;
    --charcoal-mid:   #2D3148;
    --charcoal-light: #3E4260;
    --slate:          #6B7280;
    --slate-light:    #F3F4F6;
    --success:        #10B981;
    --danger:         #EF4444;
    --info:           #3B82F6;
    --sidebar-width:  240px;
    --topbar-h:       56px;
    --radius:         12px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:      0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:      0 10px 32px rgba(0,0,0,.14);
    --font-display:   'Space Grotesk', sans-serif;
    --font-body:      'Inter', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--slate-light);
    color: var(--charcoal);
    margin: 0;
    min-height: 100vh;
}

/* ---------- Sidebar (Desktop) ---------- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--charcoal);
    z-index: 1000;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.4rem 1.25rem 1.2rem;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--saffron);
    letter-spacing: -.01em;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand i { font-size: 1.4rem; }

.sidebar-nav { padding: 1rem 0; }

.nav-list {
    list-style: none;
    margin: 0; padding: 0;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    border-radius: 0;
    transition: color .15s, background .15s;
    cursor: pointer;
}
.nav-link-item i { font-size: 1.1rem; width: 1.25rem; flex-shrink: 0; }
.nav-link-item:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}
.nav-link-item.active {
    color: var(--saffron);
    background: rgba(245,158,11,.12);
    border-right: 3px solid var(--saffron);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.07);
}
.user-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: rgba(255,255,255,.55);
    font-size: .8rem;
    margin-bottom: .75rem;
}
.user-badge i { font-size: 1.1rem; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: rgba(255,255,255,.45);
    font-size: .8rem;
    text-decoration: none;
    transition: color .15s;
}
.btn-logout:hover { color: var(--danger); }

/* ---------- Offcanvas Sidebar (Mobile) ---------- */
.sidebar-offcanvas {
    background: var(--charcoal) !important;
    width: 260px !important;
}
.sidebar-offcanvas .sidebar-brand {
    color: var(--saffron);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .65rem;
}
.sidebar-offcanvas .nav-list { padding: 1rem 0; }

/* ---------- Mobile Top Bar ---------- */
.mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--charcoal);
    padding: 0 1rem;
    height: var(--topbar-h);
    position: sticky;
    top: 0; z-index: 900;
}
.topbar-title {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    color: #fff;
}

/* ---------- Main Wrapper ---------- */
.main-wrapper {
    margin-left: 0;
    min-height: 100vh;
}
@media (min-width: 992px) {
    .main-wrapper { margin-left: var(--sidebar-width); }
}

/* ---------- Page Content ---------- */
.page-content {
    padding: 1.5rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .page-content { padding: 2rem 1.5rem; }
}
@media (min-width: 992px) {
    .page-content { padding: 2rem 2rem; }
}

/* ---------- Page Header ---------- */
.page-header {
    margin-bottom: 1.75rem;
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0 0 .25rem;
}
@media (min-width: 768px) {
    .page-header h1 { font-size: 1.75rem; }
}
.page-header p {
    color: var(--slate);
    font-size: .875rem;
    margin: 0;
}

/* ---------- Stat Cards ---------- */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,.06);
    position: relative;
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    margin-bottom: .85rem;
    flex-shrink: 0;
}
.stat-card .stat-label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--slate);
    margin-bottom: .3rem;
}
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1;
}
@media (min-width: 768px) {
    .stat-card .stat-value { font-size: 1.9rem; }
}
.stat-card .stat-sub {
    font-size: .75rem;
    color: var(--slate);
    margin-top: .3rem;
}

/* Card accent variants */
.stat-card.accent-saffron .stat-icon { background: var(--saffron-light); color: var(--saffron-dark); }
.stat-card.accent-green   .stat-icon { background: #D1FAE5; color: #065F46; }
.stat-card.accent-red     .stat-icon { background: #FEE2E2; color: #991B1B; }
.stat-card.accent-blue    .stat-icon { background: #DBEAFE; color: #1E40AF; }
.stat-card.accent-purple  .stat-icon { background: #EDE9FE; color: #5B21B6; }

/* ---------- Section Card ---------- */
.section-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,.06);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #F3F4F6;
    flex-wrap: wrap;
    gap: .5rem;
}
.section-card-header h5 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--charcoal);
}
.section-card-body { padding: 1.25rem; }

/* ---------- Tables ---------- */
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.table { margin-bottom: 0; font-size: .85rem; }
.table thead th {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--slate);
    background: #FAFAFA;
    border-bottom: 2px solid #F3F4F6;
    white-space: nowrap;
    padding: .75rem 1rem;
}
.table tbody td {
    padding: .8rem 1rem;
    vertical-align: middle;
    border-color: #F3F4F6;
    color: var(--charcoal);
}
.table tbody tr:hover { background: #FAFAFA; }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Amount formatting ---------- */
.amount-positive { color: var(--success); font-weight: 600; }
.amount-negative { color: var(--danger);  font-weight: 600; }
.amount-neutral  { color: var(--charcoal); font-weight: 600; }

/* ---------- Category badge ---------- */
.badge-category {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-raw-material   { background: #FEF3C7; color: #92400E; }
.badge-fuel           { background: #DBEAFE; color: #1E3A8A; }
.badge-other          { background: #F3F4F6; color: #374151; }
.badge-partner        { background: #EDE9FE; color: #5B21B6; }

/* ---------- Filter Bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #FAFAFA;
    border-bottom: 1px solid #F3F4F6;
}
.filter-btn {
    padding: .35rem .85rem;
    border-radius: 999px;
    border: 1.5px solid #E5E7EB;
    background: #fff;
    color: var(--slate);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.filter-btn:hover, .filter-btn.active {
    border-color: var(--saffron);
    background: var(--saffron);
    color: #fff;
}

/* ---------- Forms ---------- */
.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: .35rem;
}
.form-control, .form-select {
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: .875rem;
    padding: .55rem .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--saffron);
    box-shadow: 0 0 0 3px rgba(245,158,11,.18);
}
.form-control.is-invalid { border-color: var(--danger); }

/* ---------- Buttons ---------- */
.btn-saffron {
    background: var(--saffron);
    border-color: var(--saffron);
    color: var(--charcoal);
    font-weight: 600;
    font-size: .875rem;
    padding: .55rem 1.25rem;
    border-radius: 8px;
    transition: background .15s, transform .1s;
}
.btn-saffron:hover {
    background: var(--saffron-dark);
    border-color: var(--saffron-dark);
    color: var(--charcoal);
    transform: translateY(-1px);
}

/* ---------- Chart Container ---------- */
.chart-container {
    position: relative;
    height: 240px;
    padding: .5rem 0;
}
@media (min-width: 768px) {
    .chart-container { height: 280px; }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--slate);
}
.empty-state i { font-size: 3rem; opacity: .35; margin-bottom: 1rem; display: block; }
.empty-state p { margin: 0; font-size: .9rem; }

/* ---------- Flash Alert ---------- */
.flash-alert {
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 1.5rem;
}

/* ---------- Action Buttons in Table ---------- */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: .85rem;
    transition: all .15s;
}
.btn-action-edit  { background: #EFF6FF; color: var(--info); }
.btn-action-edit:hover  { background: var(--info); color: #fff; }
.btn-action-delete { background: #FEF2F2; color: var(--danger); }
.btn-action-delete:hover { background: var(--danger); color: #fff; }

/* ---------- Login Page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--charcoal);
    padding: 1rem;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo i {
    font-size: 2.5rem;
    color: var(--saffron);
    display: block;
    margin-bottom: .5rem;
}
.login-logo h1 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0;
}
.login-logo p {
    font-size: .8rem;
    color: var(--slate);
    margin: .2rem 0 0;
}

/* ---------- Partner Badge ---------- */
.partner-pratham  { background: #FEF3C7; color: #92400E; }
.partner-kushagra { background: #D1FAE5; color: #065F46; }
.partner-ritham   { background: #DBEAFE; color: #1E3A8A; }

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 575px) {
    .stat-card .stat-value { font-size: 1.4rem; }
    .section-card-header { flex-direction: column; align-items: flex-start; }
}
