/* ===== ARODAN PREMIUM DESIGN SYSTEM (REFACTORED) ===== */
:root {
    /* Brand Colors */
    --primary: #6C3CE1;
    --primary-gradient: linear-gradient(135deg, #6C3CE1 0%, #9333EA 100%);
    --primary-soft: rgba(108, 60, 225, 0.1);
    --secondary: #F59E0B;
    --secondary-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    
    /* Semantic Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #F43F5E;
    --info: #3B82F6;
    
    /* Neutrals */
    --dark: #1E293B;
    --dark-muted: #475569;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --white: #FFFFFF;
    
    /* Spacing System (8px) */
    --s-1: 0.5rem;  /* 8px */
    --s-2: 1rem;    /* 16px */
    --s-3: 1.5rem;  /* 24px */
    --s-4: 2rem;    /* 32px */
    --s-5: 2.5rem;  /* 40px */
    --s-6: 3rem;    /* 48px */
    --s-8: 4rem;    /* 64px */
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.85);
    --glass-blur: blur(12px);
    
    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing & Misc */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    
    /* Breakpoints */
    --screen-sm: 640px;
    --screen-md: 768px;
    --screen-lg: 1024px;
    --screen-xl: 1280px;
}

/* ===== RESET & BASE ===== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Layout Wrapper */
#app {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

/* Main Content Container */
main {
    flex: 1;
    width: 100%;
    max-width: var(--screen-xl);
    margin: 0 auto;
    padding: var(--s-2);
}

@media (min-width: 768px) {
    main { padding: var(--s-4); }
}

/* Responsive Scaling */
img, svg { display: block; max-width: 100%; height: auto; }

/* typography refactor */
h1, h2, h3, h4 { 
    font-weight: 800; 
    letter-spacing: -0.02em; 
    line-height: 1.2; 
    color: var(--dark);
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
p { font-size: 1rem; color: var(--gray-500); }

/* Buttons & Inputs Cleanup */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
}

/* ===== SCREEN SYSTEM (REFACTORED) ===== */
/* Each page is basically a screen, we remove position:absolute */
.screen {
    width: 100%;
    max-width: 600px; /* Tablet width limit for centered feel on desktop, can be adjusted */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding-bottom: 150px; /* Space for fixed bottom nav */
}

/* If on large desktop, we can have a more open layout */
@media (min-width: 1024px) {
    .screen {
        max-width: none;
        padding-bottom: 40px;
    }
}

/* ===== COMPONENTS ===== */

/* Header & Topbars */
.app-header {
    background: var(--primary-gradient);
    color: var(--white);
    padding: var(--s-5) var(--s-2);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10;
}

.header-container {
    max-width: var(--screen-xl);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Action Cards (Buttons on Dashboard) */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-2);
    margin-top: calc(var(--s-4) * -1); /* Pull up onto header */
    padding: 0 var(--s-2);
    position: relative;
    z-index: 20;
}

@media (min-width: 640px) {
    .quick-actions { grid-template-columns: repeat(4, 1fr); gap: var(--s-3); }
}

.action-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--s-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-2);
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-soft); }

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--s-3);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
    width: fit-content;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(108, 60, 225, 0.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(108, 60, 225, 0.4); opacity: 0.95; }
.btn-full { width: 100%; }

/* Form Elements */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    width: 100%;
}
.input-group label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-500);
}
.input-group input, .input-group select, .input-group textarea {
    background: var(--gray-100);
    border: 2px solid transparent;
    padding: 1rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.input-group input:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ===== NAVIGATION (REFACTORED) ===== */
.bottom-nav {
    position: fixed;
    bottom: var(--s-3);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2.5rem);
    max-width: 480px;
    height: 72px;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--s-1);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
}

/* Move nav to side or different style on desktop? No, keeping it for mobile-app feel but fixed. */
@media (min-width: 1024px) {
    .bottom-nav {
        max-width: 600px;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    gap: 4px;
    transition: var(--transition);
}
.nav-item.active { color: var(--primary); }

.book-btn {
    transform: translateY(-24px);
    background: var(--primary-gradient);
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    box-shadow: 0 8px 25px rgba(108, 60, 225, 0.4);
    border: 5px solid var(--white);
    transition: var(--transition);
}
.book-btn:hover { transform: translateY(-28px) scale(1.05) rotate(90deg); }

/* ===== DASHBOARD SPECIFIC ===== */
.promo-banner {
    background: var(--secondary-gradient);
    border-radius: var(--radius-xl);
    padding: var(--s-4);
    position: relative;
    overflow: hidden;
    color: var(--white);
    box-shadow: var(--shadow-lg);
}
.promo-banner::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 100%;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--s-2);
}
.shortcut-item {
    background: var(--white);
    padding: var(--s-2);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-1);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--gray-100);
}
.shortcut-item:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

/* ===== FOOTER (REFACTORED) ===== */
footer {
    background: var(--gray-100);
    padding: var(--s-6) var(--s-3);
    margin-top: auto;
    width: 100%;
    border-top: 1px solid var(--gray-200);
}

.footer-content {
    max-width: var(--screen-xl);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-4);
    text-align: center;
}

@media (min-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
        text-align: left;
    }
}

.footer-logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: var(--s-1); }
.footer-links { display: flex; flex-direction: column; gap: var(--s-1); }
.footer-links a { color: var(--gray-500); text-decoration: none; font-weight: 500; font-size: 0.875rem; transition: var(--transition); }
.footer-links a:hover { color: var(--primary); }

.footer-bottom {
    margin-top: var(--s-4);
    padding-top: var(--s-3);
    border-top: 1px solid var(--gray-200);
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ===== UTILS ===== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.mt-2 { margin-top: var(--s-2); }
.mb-4 { margin-bottom: var(--s-4); }

/* Animations */
@keyframes slideUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
.animate-slide-up { animation: slideUp 0.5s ease forwards; }

/* ===== AUTHENTICATION ===== */
.auth-header { text-align: center; margin-bottom: var(--s-4); }
.auth-logo { margin-bottom: var(--s-2); display: flex; justify-content: center; }
.auth-header h1 { font-size: 1.75rem; color: var(--dark); margin-bottom: 4px; }
.auth-header p { font-size: 0.875rem; color: var(--gray-400); }

.auth-role-toggle { 
    display: flex; gap: var(--s-1); background: var(--gray-100); 
    padding: 6px; border-radius: var(--radius-md); margin-bottom: var(--s-3);
    position: relative;
}
.role-btn { 
    flex: 1; padding: 10px; border-radius: var(--radius-sm); font-size: 0.875rem;
    font-weight: 700; color: var(--gray-500); background: transparent; 
    cursor: pointer; transition: var(--transition);
}
.role-btn.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }

.auth-tabs { display: flex; gap: var(--s-3); margin-bottom: var(--s-3); border-bottom: 2px solid var(--gray-100); }
.tab-btn { 
    padding: 12px 0; font-size: 0.875rem; font-weight: 700; color: var(--gray-400); 
    background: transparent; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.auth-form { display: none; flex-direction: column; gap: var(--s-3); }
.auth-form.active { display: flex; animation: slideUp 0.4s ease; }

.forgot-link { align-self: flex-end; font-size: 0.8125rem; font-weight: 700; color: var(--primary); text-decoration: none; margin-top: -8px; }

/* Empty States & Common Lists */
.delivery-list, .orders-list, .notifications-list { display: flex; flex-direction: column; gap: var(--s-2); width: 100%; }
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: var(--s-6) var(--s-3); text-align: center; background: var(--white);
    border-radius: var(--radius-lg); border: 2px dashed var(--gray-100);
}
.empty-state p { color: var(--gray-400); font-weight: 600; margin-bottom: var(--s-2); }

/* Buttons reinforcement */
.btn { 
    height: 52px; display: inline-flex; align-items: center; justify-content: center; 
    font-size: 0.9375rem; font-weight: 800; border-radius: var(--radius-md);
    padding: 0 var(--s-4); transition: var(--transition); cursor: pointer;
}
.btn-primary { background: var(--primary-gradient); color: white; border: none; }
.btn-full { width: 100%; }

/* MODALS */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: none; align-items: center; justify-content: center;
    padding: var(--s-3); z-index: 2000; backdrop-filter: blur(4px);
}
.modal.show { display: flex; }
.modal-content {
    background: var(--white); padding: var(--s-5); border-radius: var(--radius-xl);
    width: 100%; max-width: 440px; position: relative; animation: slideUp 0.3s ease;
}

/* Toast */
.toast {
    position: fixed; bottom: var(--s-8); left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--dark); color: white; padding: 12px 24px; border-radius: var(--radius-full);
    font-size: 0.875rem; font-weight: 700; z-index: 3000; box-shadow: var(--shadow-xl);
    transition: var(--transition); opacity: 0; pointer-events: none;
}
.toast.active { transform: translateX(-50%) translateY(0); opacity: 1; }
