/*
 * DishGennie — Premium Design System
 * Global tokens, utilities, and base styles
 */

/* ═══════════════════════════════════════════
   GOOGLE FONTS
   ═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════
   CSS CUSTOM PROPERTIES — DESIGN TOKENS
   ═══════════════════════════════════════════ */
:root {
    /* Shared */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', 'Inter', sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);
    --shadow-xl: 0 20px 40px -10px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 30px rgba(10,69,69,0.15);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Neutral palette */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    --white: #ffffff;
    --black: #000000;

    /* Status colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
}

/* ═══ USER PANEL THEME — Teal / Emerald ═══ */
[data-theme="user"], .theme-user {
    --primary: #0a4545;
    --primary-light: #068a8a;
    --primary-dark: #003535;
    --primary-50: #f2f4f5;
    --primary-100: #b4edec;
    --primary-500: #068a8a;
    --primary-600: #0a4545;
    --primary-700: #003535;
    --primary-900: #003535;
    --accent: #f2b359;
    --accent-light: #f0a940;
    --gradient-primary: linear-gradient(135deg, #0a4545 0%, #068a8a 100%);
    --gradient-hero: linear-gradient(135deg, #0a4545 0%, #068a8a 50%, #003535 100%);
    --gradient-card: linear-gradient(135deg, #b4edec 0%, #f2f4f5 100%);
    --sidebar-bg: var(--white);
    --sidebar-text: var(--gray-700);
    --sidebar-active: var(--primary);
}

/* ═══ MAID PANEL THEME — Violet / Purple ═══ */
[data-theme="maid"], .theme-maid {
    --primary: #7c3aed;
    --primary-light: #8b5cf6;
    --primary-dark: #6d28d9;
    --primary-50: #f5f3ff;
    --primary-100: #ede9fe;
    --primary-500: #8b5cf6;
    --primary-600: #7c3aed;
    --primary-700: #6d28d9;
    --primary-900: #4c1d95;
    --accent: #f97316;
    --accent-light: #fb923c;
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    --gradient-hero: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #6d28d9 100%);
    --gradient-card: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    --sidebar-bg: var(--white);
    --sidebar-text: var(--gray-700);
    --sidebar-active: var(--primary);
}

/* ═══ ADMIN PANEL THEME — Indigo / Dark ═══ */
[data-theme="admin"], .theme-admin {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-900: #312e81;
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
    --gradient-card: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --sidebar-active: var(--accent);
}

/* ═══════════════════════════════════════════
   GLOBAL RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    color: var(--gray-800);
    background-color: var(--gray-50);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--gray-900);
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ═══════════════════════════════════════════
   LAYOUT — DASHBOARD SHELL
   ═══════════════════════════════════════════ */
.dg-app {
    display: flex;
    min-height: 100vh;
}

.dg-sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--gray-200);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-base);
    overflow-y: auto;
}

.dg-sidebar.dark-sidebar {
    border-right-color: rgba(255,255,255,0.08);
}

.dg-sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.dg-sidebar.dark-sidebar .dg-sidebar-brand {
    border-bottom-color: rgba(255,255,255,0.08);
}

.dg-sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.dg-sidebar-brand-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--gray-900);
}

.dg-sidebar.dark-sidebar .dg-sidebar-brand-text {
    color: var(--white);
}

.dg-sidebar-brand-text span {
    color: var(--primary);
}

.dg-sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.dg-nav-section {
    margin-bottom: 8px;
}

.dg-nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--gray-400);
    padding: 8px 12px 6px;
}

.dg-sidebar.dark-sidebar .dg-nav-section-title {
    color: rgba(255,255,255,0.35);
}

.dg-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
}

.dg-nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    opacity: 0.7;
}

.dg-nav-link:hover {
    background: rgba(0,0,0,0.04);
    color: var(--primary);
    transform: translateX(3px);
}

.dg-sidebar.dark-sidebar .dg-nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.dg-nav-link.active {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.dg-nav-link.active i {
    opacity: 1;
}

.dg-nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

/* Main Content */
.dg-main {
    flex: 1;
    margin-left: 270px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dg-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
    backdrop-filter: blur(12px);
    background: rgba(255,255,255,0.85);
}

.dg-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dg-topbar-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
}

.dg-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dg-topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.dg-topbar-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.dg-topbar-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.dg-topbar-btn .notification-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--danger);
    color: var(--white);
    border: 2px solid var(--white);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.dg-topbar-btn .notification-count[hidden],
.dg-nav-badge[hidden] {
    display: none !important;
}

.dg-topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.dg-topbar-avatar:hover {
    border-color: var(--primary);
}

.dg-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--gray-700);
    cursor: pointer;
}

.dg-content {
    flex: 1;
    padding: 28px;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(10,69,69,0.3); }
    50% { box-shadow: 0 0 0 12px rgba(10,69,69,0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes counter-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-slide-in {
    animation: slideInRight 0.5s ease-out forwards;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 991.98px) {
    .dg-sidebar {
        transform: translateX(-100%);
    }

    .dg-sidebar.show {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .dg-main {
        margin-left: 0;
    }

    .dg-sidebar-toggle {
        display: block;
    }

    .dg-content {
        padding: 16px;
    }

    .dg-topbar {
        padding: 10px 16px;
    }
}

@media (max-width: 575.98px) {
    .dg-topbar-title {
        font-size: 1.1rem;
    }

    .dg-content {
        padding: 12px;
    }
}

/* ═══════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════ */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: var(--gradient-primary);
}

.bg-gradient-hero {
    background: var(--gradient-hero);
}

.glass-effect {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.3);
}

.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.03);
}

/* Sidebar overlay for mobile */
.dg-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.dg-sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ═══════════════════════════════════════════
   PAGE TRANSITIONS
   ═══════════════════════════════════════════ */
body {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.dg-page-loaded {
    opacity: 1;
}

body.dg-page-exit {
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* Top Loading Bar */
.dg-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 99999;
    box-shadow: 0 0 10px rgba(10,69,69,0.5);
}

.dg-loading-bar.active {
    width: 85%;
    transition: width 8s cubic-bezier(0.1, 0.05, 0, 1);
}

.dg-loading-bar.done {
    width: 100%;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.3s ease 0.2s;
}

/* ═══════════════════════════════════════════
   TOAST EXIT ANIMATION
   ═══════════════════════════════════════════ */
.dg-toast.toast-exit {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideOutRight {
    to { opacity: 0; transform: translateX(100px); }
}

/* ═══════════════════════════════════════════
   CONFIRMATION MODAL
   ═══════════════════════════════════════════ */
.dg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 20px;
}

.dg-modal-overlay.show {
    opacity: 1;
}

.dg-confirm-modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dg-modal-overlay.show .dg-confirm-modal {
    transform: scale(1) translateY(0);
}

.dg-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 20px;
}

.dg-confirm-icon.warning { background: var(--warning-light); color: #b45309; }
.dg-confirm-icon.danger { background: var(--danger-light); color: var(--danger); }
.dg-confirm-icon.info { background: var(--info-light); color: var(--info); }
.dg-confirm-icon.success { background: var(--success-light); color: var(--success); }

.dg-confirm-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--gray-900);
}

.dg-confirm-text {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.dg-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.dg-confirm-actions .btn-premium,
.dg-confirm-actions .btn-premium-outline {
    flex: 1;
    justify-content: center;
    padding: 10px 20px;
}

/* ═══════════════════════════════════════════
   FOCUS VISIBLE (Accessibility)
   ═══════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}
