/* ═══════════════════════════════════════════════════════════════════════════
   FranchiseOps — Custom Styles
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --fo-primary: #e65100;
    --fo-primary-dark: #bf360c;
    --fo-secondary: #263238;
    --fo-bg: #f5f5f5;
    --fo-sidebar-bg: #1a1a2e;
    --fo-sidebar-text: #e0e0e0;
    --fo-card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --fo-success: #2e7d32;
    --fo-warning: #f57f17;
    --fo-danger: #c62828;
}

body {
    background-color: var(--fo-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 250px;
    background: var(--fo-sidebar-bg);
    color: var(--fo-sidebar-text);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
}

/* ── Collapsed state ─────────────────────────────────────────────────── */
.sidebar.collapsed { width: 60px; }

/* ── Brand area (fixed top) ──────────────────────────────────────────── */
.sidebar-brand {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 18px;
    font-weight: 700;
    color: var(--fo-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 56px;
    position: relative;
}

.sidebar-brand .brand-text {
    flex: 1;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.2s ease 0.1s;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    display: none;
    transition: opacity 0.1s ease;
}

.sidebar.collapsed .sidebar-brand {
    padding: 15px 10px;
    justify-content: center;
    gap: 0;
}

/* ── Toggle button ───────────────────────────────────────────────────── */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--fo-sidebar-text);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background 0.2s, transform 0.3s;
    line-height: 1;
}

.sidebar-toggle-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.sidebar.collapsed .sidebar-toggle-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    padding: 4px;
    font-size: 14px;
}

/* ── Scrollable nav area (fills remaining space) ─────────────────────── */
.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: var(--fo-sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-nav li a {
    padding: 10px 0;
    justify-content: center;
    border-left-color: transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(255,255,255,0.08);
    border-left-color: var(--fo-primary);
    color: #fff;
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 15px;
}

.sidebar-nav li a .nav-label {
    margin-left: 10px;
    opacity: 1;
    transition: opacity 0.2s ease 0.1s;
}

.sidebar.collapsed .sidebar-nav li a .nav-label {
    opacity: 0;
    width: 0;
    display: none;
    transition: opacity 0.1s ease;
}

/* ── User section (fixed bottom) ─────────────────────────────────────── */
.sidebar-user {
    flex-shrink: 0;
    padding: 12px 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    background: var(--fo-sidebar-bg);
    z-index: 2;
    white-space: nowrap;
    overflow: hidden;
}

/* Override Bootstrap .text-muted inside sidebar — dark bg needs light text */
.sidebar .text-muted,
.sidebar .sidebar-user .text-muted,
.sidebar-user #sidebar-user-role {
    color: rgba(224, 224, 224, 0.55) !important;
}

.sidebar-user-icon {
    display: none;
    text-align: center;
    padding: 4px 0;
}

.sidebar-user-icon i { font-size: 22px; color: var(--fo-sidebar-text); }

.sidebar.collapsed .sidebar-user-icon { display: block; }
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-user { padding: 12px 0; text-align: center; }

/* ── Main content ────────────────────────────────────────────────────── */
.main-content {
    margin-left: 250px;
    padding: 20px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

body.sidebar-collapsed .main-content { margin-left: 60px; }

/* ── Mobile responsive ───────────────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); width: 250px !important; }
    .sidebar.show { transform: translateX(0); }
    .sidebar.collapsed { width: 250px !important; }
    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .sidebar-nav li a .nav-label,
    .sidebar.collapsed .sidebar-user-info { opacity: 1 !important; display: block !important; }
    .sidebar.collapsed .sidebar-user-icon { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .sidebar-toggle-btn { display: none; }
}

/* ─── KPI Cards ────────────────────────────────────────────────────────── */
.kpi-card {
    border: none; border-radius: 12px;
    box-shadow: var(--fo-card-shadow);
    transition: transform 0.2s;
}

.kpi-card:hover { transform: translateY(-2px); }

.kpi-card .card-body { padding: 20px; }
.kpi-card .kpi-value { font-size: 28px; font-weight: 700; color: var(--fo-secondary); }
.kpi-card .kpi-label { font-size: 12px; color: #999; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-card .kpi-trend { font-size: 12px; }
.kpi-card .kpi-icon { font-size: 32px; opacity: 0.3; }

/* ─── Dashboard Cards ──────────────────────────────────────────────────── */
.card { border: none; border-radius: 10px; box-shadow: var(--fo-card-shadow); margin-bottom: 20px; }
.card-header { background: white; border-bottom: 2px solid var(--fo-primary); font-weight: 600; }

/* ─── Tables ───────────────────────────────────────────────────────────── */
.table { font-size: 13px; }
.table th { background: #f8f9fa; font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }

/* ─── Alerts ───────────────────────────────────────────────────────────── */
.alert-severity-critical { border-left: 4px solid var(--fo-danger); }
.alert-severity-high { border-left: 4px solid #e53935; }
.alert-severity-medium { border-left: 4px solid var(--fo-warning); }
.alert-severity-low { border-left: 4px solid #90caf9; }

/* ─── Schedule Grid ────────────────────────────────────────────────────── */
.schedule-grid { overflow-x: auto; }
.schedule-grid table { min-width: 800px; }
.schedule-grid td { min-width: 100px; height: 50px; vertical-align: middle; text-align: center; }
.schedule-grid .understaffed { background: #ffebee; }
.schedule-grid .overstaffed { background: #e3f2fd; }

/* ─── Marketing Calendar ──────────────────────────────────────────────── */
.day-card { min-height: 200px; border-radius: 8px; }
.day-card.approved { border: 2px solid var(--fo-success); }
.post-preview { font-size: 12px; max-height: 80px; overflow: hidden; }

/* ─── Login Page ───────────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--fo-sidebar-bg) 0%, #16213e 100%);
}

.login-card {
    width: 100%; max-width: 420px; border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.login-logo {
    font-size: 32px; font-weight: 800; color: var(--fo-primary);
    text-align: center; margin-bottom: 5px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */
.btn-fo { background: var(--fo-primary); color: white; border: none; }
.btn-fo:hover { background: var(--fo-primary-dark); color: white; }

/* ─── iPad / Touch Friendly ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .btn { min-height: 44px; font-size: 16px; }
    .form-control, .form-select { min-height: 44px; font-size: 16px; }
    .table td, .table th { padding: 10px; }
}

/* ─── Print Styles ─────────────────────────────────────────────────────── */
@media print {
    .sidebar, .btn, nav, .toast-container { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ─── Loading Spinner ──────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8); z-index: 9990;
    display: flex; align-items: center; justify-content: center;
}

.loading-overlay .spinner-border { width: 3rem; height: 3rem; color: var(--fo-primary); }

/* ─── Status Indicators ───────────────────────────────────────────────── */
.stock-ok { color: var(--fo-success); }
.stock-low { color: var(--fo-warning); }
.stock-critical { color: var(--fo-danger); font-weight: 700; }

/* ─── Upsell Overlay (iPad) ────────────────────────────────────────────── */
.upsell-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}

.upsell-card {
    background: white; border-radius: 24px; padding: 40px;
    max-width: 600px; width: 90%; text-align: center;
    animation: slideUp 0.3s ease-out;
}

.upsell-card .item-name { font-size: 32px; font-weight: 700; color: var(--fo-secondary); }
.upsell-card .script-text { font-size: 22px; color: #555; margin: 20px 0; }
.upsell-card .price-tag { font-size: 28px; font-weight: 800; color: var(--fo-primary); }
.upsell-btn { min-height: 70px; font-size: 22px; border-radius: 16px; margin: 10px; }

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UI ENHANCEMENTS v2
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Typography & Base ────────────────────────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
}

/* ─── Global Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #c5c5c5; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ─── Page Fade-in ─────────────────────────────────────────────────────────── */
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.main-content { animation: pageFadeIn 0.25s ease-out; }

/* ─── Sidebar Gradient & Active Glow ──────────────────────────────────────── */
.sidebar {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    box-shadow: 4px 0 16px rgba(0,0,0,0.25);
}

.sidebar-nav li a.active {
    background: rgba(230,81,0,0.15);
    border-left-color: var(--fo-primary);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--fo-primary);
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.sidebar-brand {
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* ─── KPI Card Color Variants ─────────────────────────────────────────────── */
.kpi-card {
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.kc-revenue { border-top: 3px solid #e65100 !important; }
.kc-revenue .kpi-value { color: #e65100; }

.kc-info    { border-top: 3px solid #0288d1 !important; }
.kc-info .kpi-value { color: #0288d1; }

.kc-labor   { border-top: 3px solid #7b1fa2 !important; }
.kc-labor .kpi-value { color: #7b1fa2; }

.kc-alerts  { border-top: 3px solid #c62828 !important; }
.kc-alerts .kpi-value { color: #c62828; }

.kc-success { border-top: 3px solid #2e7d32 !important; }
.kc-success .kpi-value { color: #2e7d32; }

.kpi-card .card-body { display: flex; justify-content: space-between; align-items: center; }
.kpi-card .kpi-left  { flex: 1; }
.kpi-card .kpi-icon-wrap { font-size: 2.2rem; opacity: 0.18; }

/* ─── Improved btn-fo ──────────────────────────────────────────────────────── */
.btn-fo {
    background: linear-gradient(135deg, #e65100 0%, #bf360c 100%);
    color: white; border: none;
    box-shadow: 0 2px 8px rgba(230,81,0,0.28);
    transition: all 0.2s;
}
.btn-fo:hover, .btn-fo:focus {
    background: linear-gradient(135deg, #bf360c 0%, #9a1e00 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(230,81,0,0.38);
    transform: translateY(-1px);
}
.btn-fo:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(230,81,0,0.2); }

/* ─── Better Nav-Tabs ──────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid #e0e0e0;
    gap: 2px;
}
.nav-tabs .nav-link {
    border: none; color: #666;
    padding: 8px 16px; border-radius: 8px 8px 0 0;
    font-size: 13px; font-weight: 500;
    transition: all 0.18s;
}
.nav-tabs .nav-link:hover { background: rgba(230,81,0,0.06); color: var(--fo-primary); }
.nav-tabs .nav-link.active {
    background: white; color: var(--fo-primary);
    border-bottom: 3px solid var(--fo-primary);
    font-weight: 600;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

/* ─── Better Form Focus ────────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: rgba(230,81,0,0.5);
    box-shadow: 0 0 0 3px rgba(230,81,0,0.10);
}

/* ─── Better Cards ─────────────────────────────────────────────────────────── */
.card {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); }
.card-header {
    background: white;
    border-bottom: 2px solid var(--fo-primary);
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600; font-size: 14px;
}

/* ─── Better Tables ────────────────────────────────────────────────────────── */
.table { font-size: 13.5px; }
.table th {
    background: #fafafa; font-weight: 600;
    text-transform: uppercase; font-size: 11px;
    letter-spacing: 0.6px; color: #888;
    border-bottom: 2px solid #eee;
}
.table-hover tbody tr:hover { background: rgba(230,81,0,0.035); }

/* ─── Better Modals ────────────────────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.modal-header {
    border-bottom: 1px solid #f0f0f0;
    border-radius: 16px 16px 0 0;
    background: linear-gradient(to right, #fafafa, white);
    padding: 18px 24px;
}
.modal-footer { border-top: 1px solid #f0f0f0; padding: 16px 24px; }
.modal-body { padding: 20px 24px; }

/* ─── Progress Bar (analytics) ─────────────────────────────────────────────── */
.fo-progress {
    height: 8px; background: #f0f0f0;
    border-radius: 10px; overflow: hidden; margin-bottom: 4px;
}
.fo-progress-bar {
    height: 100%; border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.fo-pb-email    { background: linear-gradient(90deg,#546e7a,#78909c); }
.fo-pb-sms      { background: linear-gradient(90deg,#0dcaf0,#0aa8c9); }
.fo-pb-whatsapp { background: linear-gradient(90deg,#25d366,#128c41); }
.fo-pb-ig       { background: linear-gradient(90deg,#f09433,#dc2743,#bc1888); }
.fo-pb-fb       { background: linear-gradient(90deg,#1877f2,#1059b8); }
.fo-pb-tw       { background: linear-gradient(90deg,#1da1f2,#0c85d0); }

/* ─── Avatar Circle ─────────────────────────────────────────────────────────── */
.avatar-circle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    font-size: 12px; font-weight: 700; color: white;
    flex-shrink: 0;
}

/* ─── Promo Cards ───────────────────────────────────────────────────────────── */
.promo-card {
    border-radius: 12px;
    border: none;
    border-left: 4px solid #dee2e6;
    transition: transform 0.18s, box-shadow 0.18s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}
.promo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.11);
}
.promo-card.status-active    { border-left-color: #2e7d32; }
.promo-card.status-paused    { border-left-color: #f57f17; }
.promo-card.status-archived  { border-left-color: #9e9e9e; }

/* ─── Discount Type Badges ──────────────────────────────────────────────────── */
.dt-badge {
    font-size: 0.68rem; padding: 3px 8px; border-radius: 10px;
    font-weight: 700; letter-spacing: 0.3px; color: white;
    display: inline-block;
}
.dt-PercentOff  { background: linear-gradient(135deg,#e65100,#bf360c); }
.dt-DollarOff   { background: linear-gradient(135deg,#1565c0,#0d47a1); }
.dt-BOGO        { background: linear-gradient(135deg,#6a1b9a,#4a148c); }
.dt-FreeItem    { background: linear-gradient(135deg,#2e7d32,#1b5e20); }
.dt-HappyHour   { background: linear-gradient(135deg,#f9a825,#f57f17); color: #1a1a1a; }
.dt-FlatPrice   { background: linear-gradient(135deg,#0097a7,#00695c); }

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 48px 24px;
    color: #9e9e9e;
}
.empty-state .empty-icon {
    font-size: 3.5rem; opacity: 0.25;
    display: block; margin-bottom: 12px;
}
.empty-state h6 { font-weight: 600; color: #bdbdbd; margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: #bdbdbd; }

/* ─── Badge helpers ─────────────────────────────────────────────────────────── */
.badge-pill-sm { font-size: .62rem; padding: 2px 7px; border-radius: 20px; }

/* ─── Card section headers ──────────────────────────────────────────────────── */
.section-header {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: #999; margin-bottom: 8px;
    padding-bottom: 6px; border-bottom: 1px solid #f0f0f0;
}

/* ─── Account cards (social) ────────────────────────────────────────────────── */
.account-platform-icon { font-size: 2rem; opacity: 0.85; }
.account-card { transition: transform 0.18s, box-shadow 0.18s; }
.account-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.account-connected { border-left: 4px solid #2e7d32 !important; }
.account-disconnected { border-left: 4px solid #dee2e6 !important; opacity: 0.72; }
