@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;800&family=Outfit:wght@400;600;800&display=swap');

:root {
    --primary: #d97706;
    --primary-light: #fcd34d;
    --primary-dark: #b45309;
    --primary-gradient: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
    --secondary: #291507;
    --accent: #f43f5e;
    --bg: #fdfbf9;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-solid: #ffffff;
    --text: #1c1917;
    --text-muted: #78716c;
    --border: rgba(0,0,0,0.05);
    --shadow-sm: 0 4px 12px rgba(41, 21, 7, 0.04);
    --shadow-md: 0 12px 32px rgba(41, 21, 7, 0.08);
    --shadow-premium: 0 15px 45px rgba(41, 21, 7, 0.1);
    --radius: 24px;
    --radius-sm: 12px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    background-image: 
        radial-gradient(at 0% 0%, hsla(38,100%,74%,0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(11,100%,74%,0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(38,100%,74%,0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* Header Glassmorphism */
.header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.5);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header .container { display: flex; justify-content: space-between; align-items: center; }

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo h1 i { -webkit-text-fill-color: var(--primary); }

.nav { display: flex; gap: 8px; align-items: center; }

.nav a {
    color: var(--text);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
}

.nav a:hover, .nav a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.btn-register { background: var(--secondary) !important; color: white !important; }

/* Hero Section */
.hero {
    margin: 30px 24px;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(41, 21, 7, 0.9), rgba(120, 53, 15, 0.7)), url('../images/hero-bg.jpg') center/cover;
    color: white;
    padding: 100px 0;
    text-align: center;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
    animation: fadeIn 1s ease-out;
}

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

.hero::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero h2 { font-size: 4rem; margin-bottom: 24px; font-weight: 800; text-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.hero p { font-size: 1.4rem; margin-bottom: 40px; opacity: 0.9; }

.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 48px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.4);
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 32px rgba(217, 119, 6, 0.5);
}

/* Sections */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin: 50px 0 30px;
    color: var(--secondary);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.category-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    padding: 25px 15px;
    border-radius: var(--radius);
    text-align: center;
    text-decoration: none;
    color: var(--secondary);
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: var(--shadow-sm);
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    background: white;
    border-color: var(--primary-light);
}

.category-card i {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 20px;
    transition: var(--transition);
}
.category-card:hover i { transform: scale(1.1); color: var(--primary-dark); }
.category-card h3 { font-size: 1.3rem; font-weight: 800; }

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background: var(--surface-solid);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    border: 1px solid var(--border);
}

.product-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 30px 60px rgba(217, 119, 6, 0.15);
    border-color: rgba(217, 119, 6, 0.2);
}

.product-image img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    transition: var(--transition);
}
.product-card:hover .product-image img { transform: scale(1.05); }

.product-info { padding: 18px; position: relative; background: white; z-index: 1; }
.product-info h3 { font-size: 1.3rem; margin-bottom: 8px; color: var(--secondary); }
.product-category { color: var(--primary); font-size: 0.9rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.product-chef { color: var(--text-muted); font-size: 0.95rem; margin: 12px 0; display: flex; align-items: center; gap: 8px; }

.product-price {
    margin: 20px 0;
    font-size: 1.5rem;
    color: var(--secondary);
    font-weight: 800;
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-family: 'Outfit', sans-serif;
}
.product-price .currency { font-size: 1rem; color: var(--text-muted); font-family: 'Cairo', sans-serif; }
.product-price .unit { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; font-family: 'Cairo', sans-serif; }

.btn-add-cart {
    width: 100%;
    padding: 14px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-add-cart:hover { background: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(217,119,6,0.3); }

/* Forms */
.form-container {
    max-width: 480px;
    margin: 80px auto;
    background: var(--surface-solid);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.form-container h2 {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 40px;
    font-size: 2rem;
}

.form-group { margin-bottom: 24px; }
.form-group label { display: block; margin-bottom: 10px; font-weight: 600; color: var(--secondary); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
    background: #f9fafb;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: white;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.1);
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(217, 119, 6, 0.3);
}

.btn-submit:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(217, 119, 6, 0.4); }

/* Cart Sidebar Premium UX */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(41, 21, 7, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2050;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: fixed; 
    right: -100%; 
    top: 0; 
    width: 400px; 
    height: 100vh;
    background: #ffffff;
    box-shadow: -15px 0 45px rgba(0,0,0,0.15);
    transition: right 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2100;
    display: flex;
    flex-direction: column;
    border-radius: 30px 0 0 30px;
}
.cart-sidebar.open { right: 0; }

.cart-header { 
    padding: 25px; 
    background: var(--secondary); 
    color: white; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    border-radius: 30px 0 0 0;
}
.cart-header h3 { color: white; font-size: 1.5rem; margin: 0; font-weight: 800; }
.close-cart {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}
.close-cart:hover { background: rgba(255,255,255,0.2); transform: rotate(90deg); }

.cart-items { 
    flex: 1; 
    overflow-y: auto; 
    padding: 25px;
    background: #fdfbf9;
}
.cart-item { 
    background: white;
    padding: 20px; 
    border-radius: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    display: flex; 
    flex-direction: column;
    gap: 15px;
    border: 1px solid var(--border);
}

.cart-item-info h4 { font-size: 1.1rem; margin-bottom: 5px; color: var(--secondary); }
.cart-item-info p { font-size: 0.95rem; }

.cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.cart-item-controls { display: flex; align-items: center; gap: 15px; }
.cart-item-controls button { 
    background: #f3f4f6; 
    border: none; 
    width: 40px; 
    height: 40px; 
    border-radius: 12px; 
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
    font-weight: 800;
}
.cart-item-controls button:hover { background: var(--primary); color: white; }
.cart-item-controls span { font-size: 1.1rem; font-weight: 800; min-width: 25px; text-align: center; }

.btn-remove-item {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-remove-item:hover { background: #ef4444; color: white; transform: scale(1.1); }

.cart-footer { 
    padding: 30px; 
    background: white; 
    border-top: 1px solid var(--border); 
    box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
    border-radius: 0 0 0 30px;
}
.cart-total-price { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    font-size: 1.4rem; 
    font-weight: 800; 
    color: var(--secondary); 
}
.btn-submit-cart {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 20px;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.3);
}
.btn-submit-cart:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(217, 119, 6, 0.4); }

/* Alerts */
.alert { padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 24px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Footer */
.footer {
    background: var(--secondary);
    color: white;
    padding: 50px 0 20px;
    margin-top: 60px;
    position: relative;
    overflow: hidden;
}
.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary), var(--accent));
}
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px; margin-bottom: 50px; }
.footer-section h3 { margin-bottom: 24px; color: var(--primary-light); font-size: 1.4rem; }
.footer-section p { color: #d6d3d1; margin-bottom: 12px; }
.footer-section a { display: block; color: #d6d3d1; text-decoration: none; margin-bottom: 12px; transition: var(--transition); }
.footer-section a:hover { color: var(--primary-light); transform: translateX(-5px); }
.social-links { display: flex; gap: 15px; margin-top: 20px; }
.social-links a { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: white; transition: var(--transition); }
.social-links a:hover { background: var(--primary); transform: translateY(-5px); }
.footer-bottom { text-align: center; padding-top: 30px; border-top: 1px solid rgba(255,255,255,0.1); color: #a8a29e; font-size: 0.9rem; }

/* Dashboard Generics for User */
.dashboard-header { background: var(--surface-solid); padding: 25px; border-radius: var(--radius); margin-bottom: 30px; box-shadow: var(--shadow-sm); display: flex; justify-content: space-between; align-items: center; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 40px; }
.stat-card { background: var(--surface-solid); padding: 20px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: var(--transition); }
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.stat-card i { font-size: 3rem; color: var(--primary); margin-bottom: 15px; background: linear-gradient(135deg, var(--primary-light), var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card h3 { font-size: 2.2rem; color: var(--secondary); font-family: 'Outfit', sans-serif; }

/* Tables */
.table-container { background: var(--surface-solid); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; border: 1px solid var(--border); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
table th, table td { padding: 16px 20px; text-align: right; border-bottom: 1px solid var(--border); }
table th { background: #f9fafb; font-weight: 800; color: var(--secondary); text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.5px; }
table th:first-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
table th:last-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
table tr { transition: var(--transition); }
table tr:hover td { background: #fffbeb; }
.status-badge { padding: 6px 16px; border-radius: 50px; font-size: 0.85rem; font-weight: 800; display: inline-block; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* Buttons */
.btn { padding: 10px 20px; border: none; border-radius: 50px; cursor: pointer; font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 0.95rem; transition: var(--transition); display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-success { background: #10b981; color: white; }
.btn-warning { background: #f59e0b; color: white; }
.btn-danger { background: #ef4444; color: white; }
.btn-info { background: #3b82f6; color: white; }

@media (max-width: 768px) {
    .nav { display: none; position: absolute; top: 100%; right: 0; background: var(--surface-solid); width: 100%; flex-direction: column; padding: 20px; box-shadow: var(--shadow-md); }
    .nav.active { display: flex; }
    .mobile-menu-toggle { display: block; font-size: 1.8rem; color: var(--secondary); }
    .hero { margin: 15px; padding: 80px 20px; border-radius: 24px; }
    .hero h2 { font-size: 2.5rem; }
    .cart-sidebar { 
        width: 100%; 
        right: -100%; 
        border-radius: 0; 
    }
    .cart-header { border-radius: 0; }
    .cart-footer { border-radius: 0; padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
    .cart-item { padding: 15px; }
    
    /* تحويل الجداول لبطاقات في الجوال */
    .table-container table, 
    .table-container thead, 
    .table-container tbody, 
    .table-container th, 
    .table-container td, 
    .table-container tr { 
        display: block; 
    }
    .table-container thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .table-container tr {
        background: white;
        margin-bottom: 15px;
        border-radius: 15px;
        padding: 10px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
        border: 1px solid var(--border);
    }
    .table-container td {
        border: none;
        position: relative;
        padding-right: 50% !important;
        text-align: left !important;
        border-bottom: 1px solid #f0f0f0;
    }
    .table-container td:last-child { border-bottom: none; }
    .table-container td:before {
        position: absolute;
        right: 15px;
        width: 45%;
        padding-left: 10px;
        white-space: nowrap;
        content: attr(data-label);
        font-weight: 800;
        color: var(--secondary);
        text-align: right;
    }

    /* التنقل السفلي */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(15px);
        height: 70px;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
        z-index: 1000;
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 700;
        transition: var(--transition);
    }
    .mobile-bottom-nav a i { font-size: 1.4rem; margin-bottom: 4px; }
    .mobile-bottom-nav a.active { color: var(--primary); }
    .mobile-bottom-nav a.active i { transform: translateY(-5px); }
    
    .container { padding-bottom: 90px; } /* مساحة للشريط السفلي */
}

.mobile-bottom-nav { display: none; }
