/* ═══════════════════════════════════════════
   Auctusphere — Restaurant Intelligence
   Project ATH
   ═══════════════════════════════════════════ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --accent: #10b981;
    --accent-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.03);
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ═══════ SCREENS ═══════ */
.screen { display: none; }
.screen.active { display: flex; }

/* ═══════ LOGIN ═══════ */
#login-screen {
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.logo { text-align: center; margin-bottom: 32px; }
.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-size: 28px;
    font-weight: 700;
    border-radius: 16px;
    margin-bottom: 16px;
}
.logo h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.tagline { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.sub-tagline { color: var(--text-muted); font-size: 12px; margin-top: 2px; letter-spacing: 1px; text-transform: uppercase; }

/* Tab Bar */
.tab-bar {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}
.tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}
.tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Forms */
.form { display: none; }
.form.active { display: block; }

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.field input, .field select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: var(--transition);
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; min-height: 20px; }
.success-msg { color: var(--accent); font-size: 13px; margin-top: 12px; text-align: center; min-height: 20px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.outline { background: none; border: 1px solid var(--border); color: var(--text-secondary); }
.btn.outline:hover { background: var(--surface-hover); }
.btn.full { width: 100%; }
.btn.small { padding: 6px 14px; font-size: 13px; }

/* ═══════ MAIN APP LAYOUT ═══════ */
#main-app {
    min-height: 100vh;
    display: flex;
}

/* ═══════ SIDEBAR ═══════ */
#sidebar {
    width: 240px;
    min-height: 100vh;
    background: #0f172a;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo-small {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-weight: 700;
    font-size: 16px;
    border-radius: 10px;
}
.brand { font-weight: 600; font-size: 16px; }

.nav-items { flex: 1; padding: 12px 8px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(255,255,255,0.1); color: white; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.restaurant-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.tier-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.tier-badge.founding { background: linear-gradient(135deg, #f59e0b, #d97706); color: #451a03; }

/* ═══════ CONTENT ═══════ */
#content {
    flex: 1;
    margin-left: 240px;
    padding: 28px 32px;
    max-width: 1200px;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.date-label { color: var(--text-muted); font-size: 14px; }
.header-controls { display: flex; align-items: center; gap: 10px; }
.header-controls label { font-size: 14px; color: var(--text-secondary); }
.header-controls input { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; }

/* ═══════ KPI CARDS ═══════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.kpi-card.accent {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #a7f3d0;
}
.kpi-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); }
.kpi-card.accent .kpi-value { color: var(--accent-dark); }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ═══════ CHARTS ═══════ */
.chart-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.chart-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.chart-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.chart-card canvas { max-height: 250px; }

/* ═══════ SECTION CARDS ═══════ */
.section-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.section-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.action-list { list-style: none; }
.action-list li {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}
.action-list li.empty { color: var(--text-muted); background: none; }

.waste-list .waste-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    margin-bottom: 8px;
}
.waste-item-name { font-size: 14px; font-weight: 500; }
.waste-item-cost { font-size: 14px; font-weight: 600; color: var(--danger); }
.empty { color: var(--text-muted); font-size: 14px; }

/* ═══════ DATA ENTRY FORMS ═══════ */
.entry-form {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.entry-form h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.entry-form.hidden { display: none; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.form-grid .field.full { grid-column: 1 / -1; }

.form-actions { display: flex; gap: 10px; }

/* ═══════ DATA TABLES ═══════ */
.data-table {
    width: 100%;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-hover); }
.data-table .amount { font-weight: 600; }
.data-table .category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ═══════ REPORT ═══════ */
.report-container { }
.report-header {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
    padding: 28px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.report-header h3 { font-size: 18px; margin-bottom: 4px; }
.report-header .period { font-size: 14px; color: rgba(255,255,255,0.7); }
.report-body {
    background: var(--surface);
    padding: 24px;
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--border);
    border-top: none;
}
.report-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.report-kpi {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.report-kpi .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.report-kpi .value { font-size: 22px; font-weight: 700; }
.report-kpi .value.good { color: var(--accent); }
.report-kpi .value.bad { color: var(--danger); }
.report-kpi .value.warn { color: var(--warning); }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-row { grid-template-columns: 1fr; }
    .report-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    #sidebar { width: 60px; }
    #sidebar .brand, #sidebar .restaurant-label, #sidebar .tier-badge, .nav-item span:not(.icon) { display: none; }
    .sidebar-header { justify-content: center; }
    .nav-item { justify-content: center; padding: 10px; }
    #content { margin-left: 60px; padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
