@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* =========================================
   1. DESIGN SYSTEM & VARIABLES
========================================= */
:root {
    /* Brand Colors */
    --brand-primary: #2d8eff; /* AFIT Blue */
    --brand-hover: #1a73e8;
    --brand-light: rgba(45, 142, 255, 0.1);

    /* Backgrounds (Light Theme) */
    --bg-body: #e2e8f0;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.85);
    
    /* Typography (Light Theme) */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    /* Borders & Shadows (Light Theme) */
    --border-color: #e2e8f0;
    --border-glass: rgba(255, 255, 255, 0.4);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);

    /* Category Icon Colors (Light) */
    --cat-red-bg: #fff1f2;    --cat-red-txt: #e11d48;
    --cat-blue-bg: #eff6ff;   --cat-blue-txt: #2563eb;
    --cat-pink-bg: #fdf2f8;   --cat-pink-txt: #db2777;
    --cat-orange-bg: #fff7ed; --cat-orange-txt: #ea580c;
    --cat-yellow-bg: #fefce8; --cat-yellow-txt: #ca8a04;
    --cat-rose-bg: #fff1f2;   --cat-rose-txt: #be123c;
    --cat-green-bg: #f0fdf4;  --cat-green-txt: #16a34a;
    --cat-gray-bg: #f1f5f9;   --cat-gray-txt: #475569;

    /* Skeletons */
    --shimmer-grad: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
}

/* 🌙 Dark Mode Variables Swap (No !important needed) */
body.dark-mode {
    --bg-body: #020617;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #020617;
    --glass-bg: rgba(15, 23, 42, 0.85);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    --border-glass: rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);

    /* Category Icon Colors (Dark - softer backgrounds, vibrant text) */
    --cat-red-bg: rgba(225, 29, 72, 0.15);    --cat-red-txt: #fb7185;
    --cat-blue-bg: rgba(37, 99, 235, 0.15);   --cat-blue-txt: #60a5fa;
    --cat-pink-bg: rgba(219, 39, 119, 0.15);  --cat-pink-txt: #f472b6;
    --cat-orange-bg: rgba(234, 88, 12, 0.15); --cat-orange-txt: #fb923c;
    --cat-yellow-bg: rgba(202, 138, 4, 0.15); --cat-yellow-txt: #facc15;
    --cat-rose-bg: rgba(190, 18, 60, 0.15);   --cat-rose-txt: #fb7185;
    --cat-green-bg: rgba(22, 163, 74, 0.15);  --cat-green-txt: #4ade80;
    --cat-gray-bg: rgba(71, 85, 105, 0.2);    --cat-gray-txt: #cbd5e1;

    --shimmer-grad: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
}

/* =========================================
   2. RESET & BASE
========================================= */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

body { 
    background-color: var(--bg-body); 
    display: flex; 
    justify-content: center; 
    color: var(--text-main);
    transition: background-color 0.3s ease;
}

.app-container {
    background: var(--bg-main); 
    width: 100%; 
    max-width: 480px; 
    min-height: 100vh;
    box-shadow: var(--shadow-lg); 
    position: relative; 
    display: flex; 
    flex-direction: column;
}

/* =========================================
   3. HEADER & NAVIGATION
========================================= */
.header { 
    background: var(--glass-bg); 
    padding: 16px 20px; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.header-top { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 16px; 
}

.logo-link { transition: transform 0.2s; }
.logo-link:active { transform: scale(0.95); }
.header-logo { max-height: 40px; }

/* Notification Icon */
.notify-icon-container { 
    position: relative; 
    font-size: 22px; 
    color: var(--brand-primary); 
    text-decoration: none; 
    transition: transform 0.2s; 
}
.notify-icon-container:active { transform: scale(0.9); }
.notify-dot, .msg-dot { 
    position: absolute; 
    background: #ef4444; 
    border-radius: 50%; 
    border: 2px solid var(--bg-main); 
    display: none; 
}
.notify-dot { top: -2px; right: -2px; width: 10px; height: 10px; }
.msg-dot { top: -2px; right: -4px; width: 10px; height: 10px; }

/* Search Box */
.search-box { 
    background: var(--bg-input); 
    border: 1px solid var(--border-color);
    border-radius: 12px; 
    display: flex; 
    align-items: center; 
    padding: 12px 16px; 
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-light);
}
.search-icon { color: var(--text-muted); margin-right: 12px; cursor: pointer; }
.search-box input { 
    border: none; 
    background: transparent; 
    outline: none; 
    width: 100%; 
    font-size: 14px; 
    color: var(--text-main); 
}
.search-box input::placeholder { color: var(--text-muted); }

/* =========================================
   4. MAIN CONTENT & CATEGORIES
========================================= */
.content-area { flex: 1; overflow-y: auto; padding-bottom: 90px; }

.category-grid {
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 16px 12px;
    padding: 20px; 
    background: var(--bg-card); 
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.cat-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; }
.cat-icon-box {
    width: 56px; height: 56px; border-radius: 16px;
    display: flex; justify-content: center; align-items: center; font-size: 24px; margin-bottom: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cat-item:active .cat-icon-box { transform: scale(0.92); }
.cat-name { font-size: 11px; text-align: center; color: var(--text-main); font-weight: 600; }

/* Dynamic Category Colors */
.cat-red { background: var(--cat-red-bg); color: var(--cat-red-txt); }
.cat-blue { background: var(--cat-blue-bg); color: var(--cat-blue-txt); }
.cat-pink { background: var(--cat-pink-bg); color: var(--cat-pink-txt); }
.cat-orange { background: var(--cat-orange-bg); color: var(--cat-orange-txt); }
.cat-yellow { background: var(--cat-yellow-bg); color: var(--cat-yellow-txt); }
.cat-rose { background: var(--cat-rose-bg); color: var(--cat-rose-txt); }
.cat-green { background: var(--cat-green-bg); color: var(--cat-green-txt); }
.cat-gray { background: var(--cat-gray-bg); color: var(--cat-gray-txt); }

/* =========================================
   5. SECTIONS & CARDS
========================================= */
.section-wrapper { padding: 12px 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--text-main); letter-spacing: -0.3px; }
.see-all { font-size: 13px; color: var(--brand-primary); font-weight: 600; text-decoration: none; }
.see-all:hover { color: var(--brand-hover); }

/* Product Grid */
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
    background: var(--bg-card); 
    border-radius: 16px; 
    padding: 12px;
    box-shadow: var(--shadow-sm); 
    cursor: pointer; 
    border: 1px solid var(--border-color);
    display: flex; flex-direction: column; height: 100%; overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:active { transform: translateY(2px); box-shadow: none; }
.card-img { width: 100%; height: 140px; object-fit: cover; border-radius: 12px; background: var(--bg-input); margin-bottom: 12px; }
.card-price { font-size: 16px; font-weight: 700; color: var(--brand-primary); margin-bottom: 4px; }
.card-title { font-size: 13px; color: var(--text-main); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.card-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

/* Review Slider */
.reviews-slider { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.reviews-slider::-webkit-scrollbar { display: none; }
.review-card { 
    min-width: 280px; 
    background: var(--bg-card); 
    padding: 16px; 
    border-radius: 16px; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border-color); 
    scroll-snap-align: start; 
}
.rev-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rev-img { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-input); object-fit: cover; }
.rev-name { font-size: 14px; font-weight: 700; color: var(--text-main); }
.rev-stars { color: #f59e0b; font-size: 11px; margin-top: 2px;}
.rev-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;}

/* Blog List */
.blog-card { 
    display: flex; gap: 16px; background: var(--bg-card); padding: 16px; 
    border-radius: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border-color); cursor: pointer; transition: transform 0.2s; 
}
.blog-card:active { transform: scale(0.98); }
.blog-img { width: 90px; height: 90px; border-radius: 12px; object-fit: cover; background: var(--bg-input); flex-shrink: 0; }
.blog-info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.blog-cat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.blog-cat { font-size: 10px; font-weight: 800; color: var(--brand-primary); text-transform: uppercase; letter-spacing: 0.5px;}
.blog-date { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.blog-title { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blog-desc { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }

/* =========================================
   6. FOOTER
========================================= */
.footer {
    background: var(--brand-primary); color: var(--text-inverse); 
    padding: 30px 24px 100px; 
    border-radius: 24px 24px 0 0; position: relative;
    overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
}
.footer.collapsed { max-height: 140px; } 
.footer.expanded { max-height: 500px; }

.footer-toggle { 
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); 
    color: rgba(255, 255, 255, 0.8); font-size: 14px; cursor: pointer; padding: 10px; 
}
.footer-top-collapsed { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.download-app-btn {
    background: var(--bg-card); color: var(--brand-primary); border: none; padding: 12px 20px; 
    border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; transition: 0.2s;
}
.download-app-btn:active { transform: scale(0.95); }

.footer-expanded-links { margin-top: 30px; border-top: 1px solid rgba(255, 255, 255, 0.2); padding-top: 30px; display: none; }
.footer.expanded .footer-expanded-links { display: block; animation: fadeIn 0.4s; }
.footer-links-grid { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.footer-links-grid a { color: var(--text-inverse); text-decoration: none; font-size: 14px; font-weight: 600; opacity: 0.9; }
.copyright-text { font-size: 12px; color: rgba(255, 255, 255, 0.7); text-align: center; margin: 0; font-weight: 500; }

@keyframes fadeIn { from {opacity: 0; transform: translateY(10px);} to {opacity: 1; transform: translateY(0);} }

/* =========================================
   7. BOTTOM NAVIGATION
========================================= */
.bottom-nav {
    position: fixed; bottom: 0; width: 100%; max-width: 480px; 
    background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    display: flex; justify-content: space-around; align-items: center;
    padding: 12px 0 24px; border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.06); z-index: 1000; 
    border-top: 1px solid var(--border-glass);
}
.nav-item { 
    display: flex; flex-direction: column; align-items: center; 
    color: var(--text-muted); text-decoration: none; font-size: 11px; 
    font-weight: 600; transition: color 0.2s; width: 64px; 
}
.nav-item i { font-size: 22px; margin-bottom: 6px; transition: transform 0.2s; }
.nav-item.active { color: var(--brand-primary); }
.nav-item.active i { transform: translateY(-3px); }
.icon-wrapper { position: relative; }

.nav-fab {
    width: 56px; height: 56px; background: var(--brand-primary); color: white;
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    font-size: 22px; margin-top: -30px; box-shadow: 0 8px 24px var(--brand-light);
    cursor: pointer; transition: transform 0.2s; border: 5px solid var(--bg-main);
}
.nav-fab:active { transform: scale(0.9); }

/* =========================================
   8. MODALS & POPUPS
========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(2, 6, 23, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 10000; display: flex; justify-content: center; align-items: center; padding: 20px;
    opacity: 1; visibility: visible; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; visibility: hidden; }

.ad-modal-box, .ios-modal-box { 
    background: var(--bg-card); border-radius: 24px; overflow: hidden; 
    max-width: 360px; width: 100%; box-shadow: var(--shadow-lg); 
    position: relative; animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    border: 1px solid var(--border-color);
}
.ios-modal-box { padding: 32px 24px; text-align: center; }

.modal-close-btn { 
    position: absolute; top: 16px; right: 16px; 
    background: rgba(0,0,0,0.4); color: white; border: none; 
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; 
    z-index: 10; display: flex; justify-content: center; align-items: center; 
    backdrop-filter: blur(4px); transition: 0.2s;
}
.modal-close-btn:hover { background: rgba(0,0,0,0.6); }

.ad-image { width: 100%; height: 200px; object-fit: cover; }
.ad-image.hidden { display: none; }
.ad-content-wrapper { padding: 24px; text-align: center; }

.modal-title { margin: 0 0 12px; font-size: 20px; font-weight: 700; color: var(--text-main); }
.modal-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; }

.btn-primary { 
    display: block; background: var(--brand-primary); color: var(--text-inverse); 
    text-decoration: none; padding: 14px; border-radius: 14px; 
    font-weight: 700; font-size: 15px; transition: 0.2s; text-align: center; border: none;
}
.btn-primary:active { transform: scale(0.97); }
.w-full { width: 100%; }

.ios-icon-box { 
    width: 64px; height: 64px; background: var(--cat-blue-bg); color: var(--brand-primary); 
    border-radius: 18px; display: flex; justify-content: center; align-items: center; 
    font-size: 32px; margin: 0 auto 20px; 
}
.ios-instructions { 
    text-align: left; background: var(--bg-input); padding: 16px; 
    border-radius: 16px; border: 1px solid var(--border-color); margin-bottom: 24px; 
}
.ios-instructions p { font-size: 13px; color: var(--text-main); margin-bottom: 10px; }
.ios-instructions p:last-child { margin-bottom: 0; }
.highlight-icon { color: var(--brand-primary); margin: 0 4px; }

@keyframes modalSlideUp { from { transform: translateY(40px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* =========================================
   9. SKELETON LOADERS
========================================= */
.skeleton { pointer-events: none; }
.sk-shimmer { 
    background: var(--shimmer-grad); 
    background-size: 200% 100%; 
    animation: shimmer 1.5s infinite linear; 
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.sk-img { width: 100%; height: 140px; border-radius: 10px; margin-bottom: 12px; flex-shrink: 0; }
.sk-line { height: 12px; border-radius: 6px; margin-bottom: 8px; }
.sk-line.micro { width: 20%; }
.sk-line.short { width: 40%; }
.sk-line.medium { width: 70%; }
.sk-line.long { width: 100%; }
.sk-text-group { flex: 1; display: flex; flex-direction: column; }
.center-vertical { justify-content: center; }
.margin-bottom { margin-bottom: 12px; }

.sk-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.sk-v-avatar { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; flex-shrink: 0; }
.sk-b-img { width: 90px; height: 90px; border-radius: 12px; flex-shrink: 0; }
.center-align { align-items: center; }

/* Utilities applied by JS */
.theme-toggle-btn {
    background: none; border: none; font-size: 22px; color: var(--brand-primary); 
    cursor: pointer; margin-left: auto; margin-right: 16px; transition: transform 0.2s;
}
.theme-toggle-btn:active { transform: scale(0.85); }