:root {
    --primary-yellow: #F59E0B; /* Saffron */
    --primary-yellow-hover: #D97706;
    --indigo: #3730A3; /* Moroccan Indigo */
    --indigo-light: #EEF2FF;
    --teal: #0D9488; /* Atlas Teal */
    --teal-light: #F0FDFA;
    --pink: #DB2777; /* Henna Pink */
    --dark: #1E1B4B;
    --light-grey: #F8FAFC;
    --white: #FFFFFF;
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --border-radius: 24px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Moroccan Specific Tokens */
    --saffron-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --indigo-gradient: linear-gradient(135deg, #3730A3 0%, #312E81 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #F8FAFC;
    color: var(--dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Desktop Wrapper to simulate a phone */
.mobile-wrapper {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background-color: var(--white);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.96)),
        url('assets/images/zellij_pattern.png');
    background-size: cover;
    background-position: center;
    position: relative;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0,0,0,0.12);
}

/* Header */
.app-header {
    padding: 24px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-container {
    position: relative;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--primary-yellow);
    object-fit: cover;
}

.level-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--indigo);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

.points-pill {
    background: var(--indigo-light);
    color: var(--indigo);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.points-pill i {
    color: var(--primary-yellow);
}

/* Hero Section */
.hero-card {
    margin: 0 20px 24px;
    background: var(--indigo-gradient);
    border-radius: var(--border-radius);
    padding: 28px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(55, 48, 163, 0.25);
}

.hero-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.hero-card h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.hero-card p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.btn-hero {
    background: var(--saffron-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.3);
}

.btn-hero:active {
    transform: scale(0.92) translateY(2px);
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.2);
}

/* Categories Scroll */
.categories-scroll {
    display: flex;
    gap: 12px;
    padding: 0 20px 24px;
    overflow-x: auto;
    scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
    padding: 10px 24px;
    background: white;
    border: 1px solid transparent;
    border-radius: 30px;
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 700;
    color: #64748B;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: var(--transition);
    cursor: pointer;
}

.cat-chip:active {
    transform: scale(0.95);
}

.cat-chip.active {
    background: var(--saffron-gradient);
    color: white;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

/* Quest Section */
.section-title {
    padding: 0 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.section-title a {
    color: var(--indigo);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 600;
}

.quest-list {
    padding: 0 20px 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quest-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 18px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(241, 245, 249, 0.8);
    transition: var(--transition);
}

.quest-card:active {
    transform: scale(0.97);
}

.quest-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.quest-details {
    flex: 1;
}

.quest-details h4 {
    font-size: 1rem;
    margin-bottom: 4px;
    font-weight: 700;
}

.quest-details p {
    font-size: 0.8rem;
    color: #64748B;
    margin-bottom: 12px;
}

.quest-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quest-reward {
    color: var(--teal);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.progress-bar {
    height: 6px;
    background: #F1F5F9;
    border-radius: 3px;
    width: 60px;
    position: relative;
}

.progress-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: var(--indigo);
    border-radius: 3px;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 420px;
    height: 70px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 25px rgba(0,0,0,0.06);
    border-radius: 24px 24px 0 0;
    z-index: 1000;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    transition: var(--transition);
    flex: 1;
    padding-top: 8px;
}

.nav-item i {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.nav-item.active {
    color: var(--indigo);
}

.nav-item.active i {
    transform: translateY(-4px);
}

.nav-item:active {
    transform: scale(0.9);
}

/* Floating Action Placeholder */
.fab {
    width: 64px;
    height: 64px;
    background: var(--primary-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    font-size: 1.6rem;
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.4);
    transform: translateY(-25px);
    border: 5px solid white;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.fab:active {
    transform: translateY(-25px) scale(0.92);
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

/* Profile Page Styles */
.profile-hero {
    padding: 60px 20px 40px;
    background: linear-gradient(135deg, var(--indigo) 0%, #312E81 100%);
    color: white;
    text-align: center;
    border-radius: 0 0 40px 40px;
    position: relative;
    overflow: hidden;
}

.profile-avatar-large {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 4px solid var(--primary-yellow);
    margin: 0 auto 16px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.xp-container {
    background: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: 4px;
    width: 140px;
    margin: 12px auto 0;
    position: relative;
}

.xp-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: var(--primary-yellow);
    border-radius: 4px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 20px;
    margin-top: -30px;
    position: relative;
    z-index: 10;
}

.stat-item {
    background: white;
    padding: 16px 8px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.stat-item span {
    display: block;
}

.stat-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-label {
    font-size: 0.7rem;
    color: #94A3B8;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 4px;
}

.profile-menu {
    padding: 30px 20px 100px;
}

.menu-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-left: 8px;
}

.menu-list {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #F1F5F9;
    margin-bottom: 24px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 600;
    border-bottom: 1px solid #F1F5F9;
    transition: var(--transition);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: #F8FAFC;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.menu-item span {
    flex: 1;
}

.menu-item .fa-chevron-right {
    font-size: 0.8rem;
    color: #CBD5E1;
}
/* =========================================================
   Mobile Merchant & Detail Styles
   ========================================================= */

/* Merchant List */
.merchant-grid {
    padding: 0 20px 100px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.merchant-card {
    background: white;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid #F1F5F9;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.merchant-card:active {
    transform: scale(0.96);
}

.merchant-logo-wrap {
    width: 80px;
    height: 80px;
    background: #F8FAFC;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border: 1px solid #F1F5F9;
}

.merchant-logo-wrap img {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
}

.merchant-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.merchant-card p {
    font-size: 0.75rem;
    color: #94A3B8;
}

/* Merchant Detail Header */
.merchant-detail-hero {
    padding: 80px 20px 30px;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    text-align: center;
    position: relative;
}

.detail-logo-large {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-lg);
}

.detail-logo-large img {
    max-width: 70%;
    max-height: 70%;
}

/* Product/Service Grid */
.inventory-grid {
    padding: 24px 20px 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.inventory-item {
    background: white;
    border-radius: 20px;
    padding: 12px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #F1F5F9;
}

.inventory-img {
    width: 100px;
    height: 100px;
    background: #F8FAFC;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-img img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 12px;
}

.inventory-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.inventory-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.inventory-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.price-mad {
    font-size: 1rem;
    font-weight: 800;
    color: var(--dark);
}

.reward-pts {
    background: var(--teal-light);
    color: var(--teal);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Form Styles */
.form-container {
    padding: 24px 20px 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #94A3B8;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    background: #F8FAFC;
    border: 1px solid #F1F5F9;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--dark);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--indigo);
    background: white;
    box-shadow: 0 0 0 4px var(--indigo-light);
}

.avatar-edit-wrap {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
}

.avatar-edit-wrap img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: var(--shadow-sm);
}

.edit-icon-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-yellow);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    font-size: 0.8rem;
    color: var(--dark);
}

.btn-submit {
    width: 100%;
    padding: 18px;
    background: var(--indigo);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.25);
}

.btn-submit:active {
    transform: scale(0.98);
}

/* Login Flow Styles */
.onboarding-screen {
    text-align: center;
    padding: 40px 20px;
}

.onboarding-img {
    width: 100%;
    max-width: 300px;
    margin: 40px auto;
}

.login-tabs {
    display: flex;
    background: #F8FAFC;
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.login-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-weight: 700;
    color: #64748B;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.login-tab.active {
    background: var(--primary-yellow);
    color: var(--dark);
    box-shadow: var(--shadow-sm);
}

.social-auth {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dark);
    cursor: pointer;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: #94A3B8;
    font-size: 0.8rem;
    font-weight: 600;
}

.auth-divider::before, 
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #E2E8F0;
}

.auth-divider span {
    padding: 0 15px;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i:first-child {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
}

.input-icon-wrap .fa-eye-slash {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
}

.input-icon-wrap .form-control {
    padding-left: 48px;
    padding-right: 48px;
}

.remember-forget {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 30px;
    font-size: 0.85rem;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.custom-checkbox input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #CBD5E1;
    border-radius: 50%;
    position: relative;
}

.custom-checkbox input:checked + .checkmark {
    border-color: var(--indigo);
    background: var(--indigo);
}

.custom-checkbox input:checked + .checkmark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.state-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.auth-screen.active {
    display: block;
}

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

