/* FabroZit - mobile-first storefront */

:root {
    --primary: #83c33b;
    --primary-dark: #6eaa2b;
    --primary-light: #edf7e4;
    --secondary: #25241f;
    --accent: #b7d88e;
    --bg-main: #fbfcf9;
    --bg-white: #FFFFFF;
    --text-main: #344054;
    --text-muted: #667085;
    --border-color: #EAECF0;
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 12px 24px -4px rgba(79, 117, 48, 0.14);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-round: 50px;
    --nav-height: 65px; /* bottom nav height */
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body { font-family: 'Tajawal', 'Outfit', sans-serif; background-color: var(--bg-main); color: var(--text-main); line-height: 1.6; overflow-x: hidden; padding-bottom: calc(var(--nav-height) + 10px); }
@media (min-width: 769px) { body { padding-bottom: 0; } }

h1, h2, h3, h4 { font-family: 'Outfit', 'Tajawal', sans-serif; color: var(--secondary); font-weight: 700; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; background: transparent; }
input, select { font-family: inherit; outline: none; }

.container { max-width: 1300px; margin: 0 auto; padding: 0 16px; }

/* Utilities */
.desktop-only { display: none !important; }
.desktop-only-flex { display: none !important; }
@media (min-width: 769px) {
    .desktop-only { display: block !important; }
    .desktop-only-flex { display: flex !important; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 24px; border-radius: var(--radius-round); font-weight: 700; font-size: 0.95rem; transition: var(--transition); }
.btn-primary { background: var(--primary-dark); color: white; box-shadow: 0 4px 15px rgba(110, 170, 43, 0.25); }
.btn-primary:hover { background: #e85d82; }

/* Main Header */
.header { background: rgba(255, 255, 255, 0.98); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; padding: 10px 0; }
.header-inner { display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
@media (min-width: 769px) {
    .header-inner { flex-direction: row; justify-content: space-between; align-items: center; padding: 15px 24px; }
}

.logo { font-size: 1.6rem; font-weight: 800; color: var(--secondary); display: flex; align-items: center; gap: 8px; justify-content: center; }
.logo-icon { color: var(--primary-dark); font-size: 1.5rem; }

.search-bar { width: 100%; position: relative; display: flex; background: var(--bg-main); border-radius: var(--radius-round); border: 1px solid var(--border-color); padding: 4px 15px; }
.search-bar input { flex: 1; border: none; background: transparent; padding: 8px; font-size: 0.9rem; }
.search-bar button { color: var(--text-muted); font-size: 1rem; }

.mobile-logo-text { display: block; font-family: 'Pacifico', 'Dancing Script', cursive; font-size: 2rem; color: var(--primary-dark); padding: 0 10px; }
.desktop-logo-img { display: none; }

@media (min-width: 769px) {
    .search-bar { flex: 0 1 500px; }
    .logo { justify-content: flex-start; font-size: 2rem; }
    .mobile-logo-text { display: none; }
    .desktop-logo-img { display: flex; align-items: center; gap: 8px;}
}

/* Header Actions (Desktop focus) */
.header-actions { display: flex; align-items: center; gap: 15px; }
.action-btn { position: relative; display: flex; align-items: center; gap: 8px; background: var(--bg-main); border: 1px solid var(--border-color); padding: 10px 15px; border-radius: var(--radius-round); cursor: pointer; color: var(--secondary); font-weight: 600; }
.cart-badge { position: absolute; top: -5px; right: -5px; background: var(--primary-dark); color: white; font-size: 0.7rem; width: 18px; height: 18px; display: flex; justify-content: center; align-items: center; border-radius: 50%; font-weight: bold; border: 2px solid white; }

/* Categories Desktop Nav */
.cat-nav { border-bottom: 4px solid var(--primary-light); }
.cat-nav-inner .nav-links { display: flex; gap: 30px; padding: 12px 0; justify-content: center; }
.cat-nav-inner .nav-links a { color: var(--text-muted); font-weight: 600; font-size: 1rem; }
.cat-nav-inner .nav-links a:hover, .cat-nav-inner .nav-links a.active { color: var(--primary-dark); }

/* Hero Section (Mobile Optimized) */
.hero-section { padding: 30px 0; overflow: hidden; background: white; }
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 30px; }
.hero-content { width: 100%; position: relative; z-index: 10; animation: slideUpFade 0.8s ease-out; }
.hero-content h1 { font-size: 2.8rem; line-height: 1.2; margin-bottom: 15px; letter-spacing: -1px; }
.badge { display: inline-block; padding: 5px 12px; background: var(--primary-light); color: var(--primary-dark); font-weight: 700; border-radius: var(--radius-round); font-size: 0.8rem; margin-bottom: 15px; }
.highlight { color: var(--primary-dark); }
.hero-content p { font-size: 1rem; color: var(--text-muted); margin-bottom: 25px; padding: 0 15px; }
.hero-btns { justify-content: center; display: flex;}
.hero-image-wrapper { width: 100%; max-width: 320px; position: relative; display: flex; justify-content: center; margin-top: 10px; }
.hero-img { width: 100%; height: clamp(260px, 36vw, 430px); object-fit: cover; object-position: right center; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); z-index: 2; }
.blob-bg { position: absolute; width: 350px; height: 350px; background: linear-gradient(135deg, var(--primary-light), #fff); border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; z-index: 1; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.floating-card { position: absolute; background: white; padding: 6px 12px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); font-weight: 700; z-index: 3; display: flex; align-items: center; gap: 6px; color: var(--secondary); font-size: 0.85rem;}
.floating-card i { color: var(--accent); }
.c1 { top: 10%; right: -10px; animation: float 4s ease-in-out infinite; }
.c2 { bottom: 10%; left: -10px; animation: float 5s ease-in-out infinite reverse; }

@media (min-width: 769px) {
    .hero-section { padding: 60px 0; }
    .hero-inner { flex-direction: row; text-align: right; justify-content: space-between; gap: 40px; }
    .hero-content h1 { font-size: 4.5rem; }
    .hero-content p { font-size: 1.25rem; padding: 0;}
    .hero-btns { justify-content: flex-start;}
    .hero-image-wrapper { max-width: 500px; }
    .blob-bg { width: 600px; height: 600px; }
    .floating-card { padding: 12px 20px; font-size: 1rem; }
    .c1 { right: -20px; }
    .c2 { left: -20px; }
}

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Mobile Story-like Categories */
.story-categories { padding: 25px 0; background: var(--bg-main); overflow: hidden; }
.section-header { margin-bottom: 20px; text-align: right; padding: 0 16px; }
.section-header h2 { font-size: 1.5rem; }
@media (min-width: 769px) { .section-header h2 { font-size: 2.2rem; } }

.story-container { display: flex; gap: 15px; overflow-x: auto; padding: 5px 16px 15px; scrollbar-width: none; -ms-overflow-style: none; }
.story-container::-webkit-scrollbar { display: none; }
.story-item { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; cursor: pointer; width: 75px; animation: slideUpFade 0.6s ease-out both; }
.story-item:nth-child(2) { animation-delay: 0.1s; }
.story-item:nth-child(3) { animation-delay: 0.2s; }
.story-item:nth-child(4) { animation-delay: 0.3s; }
.story-item:nth-child(n+5) { animation-delay: 0.4s; }
.story-ring { width: 70px; height: 70px; border-radius: 50%; padding: 3px; background: linear-gradient(45deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.story-ring img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid white; object-fit: cover; }
.story-item span { font-size: 0.85rem; font-weight: 600; color: var(--text-main); }
@media (min-width: 769px) {
    .story-container { justify-content: center; gap: 30px; }
    .story-item { width: 120px; }
    .story-ring { width: 110px; height: 110px; padding: 4px; }
    .story-item span { font-size: 1.1rem; }
}

/* Products Section & Mobile Grid */
.products-section { padding: 20px 0 40px; }
.filter-btns-scroll { width: 100%; overflow-x: auto; padding: 0 16px 15px; scrollbar-width: none; }
.filter-btns-scroll::-webkit-scrollbar { display: none; }
.filter-btns { display: flex; gap: 10px; width: max-content; }
@media (min-width: 769px) {
    .filter-btns-scroll { overflow-x: visible; padding: 0; }
    .filter-btns { margin: 0 auto; justify-content: center; width: 100%; }
}

.filter-btn { padding: 6px 16px; border-radius: var(--radius-round); font-weight: 600; font-size: 0.9rem; color: var(--text-muted); background: white; border: 1px solid var(--border-color); white-space: nowrap; }
.filter-btn.active, .filter-btn:hover { background: var(--primary-dark); color: white; border-color: var(--primary-dark); }

.products-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 20px; padding: 0 16px; }
@media (min-width: 769px) {
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; padding: 0; }
}

.product-card { background: white; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); position: relative; display: flex; flex-direction: column; animation: slideUpFade 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.product-card:nth-child(even) { animation-delay: 0.15s; }
.pro-img-box { position: relative; height: 180px; overflow: hidden; background: #f9f9f9;}
.pro-img-box img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 769px) { .pro-img-box { height: 300px; } }

.pro-actions { position: absolute; bottom: 10px; right: 10px; display: flex; flex-direction: column; gap: 8px; }
.pro-action-btn { width: 35px; height: 35px; background: rgba(255,255,255,0.9); color: var(--secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; box-shadow: var(--shadow-sm); transition: var(--transition); }
.pro-action-btn:hover { background: var(--primary-dark); color: white; }

.pro-info { padding: 12px; text-align: right; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.pro-cat { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 3px; }
.pro-title { font-size: 0.95rem; margin-bottom: 6px; color: var(--secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 2.6em; line-height: 1.3;}
.pro-price { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); }
@media (min-width: 769px) {
    .pro-info { padding: 20px; text-align: center; }
    .pro-title { font-size: 1.15rem; height: auto; white-space: nowrap; }
    .pro-price { font-size: 1.3rem; }
    .pro-actions { flex-direction: row; bottom: -50px; left: 0; width: 100%; justify-content: center; background: linear-gradient(to top, rgba(0,0,0,0.5), transparent); padding: 15px; }
    .product-card:hover .pro-actions { bottom: 0; }
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height); background: white; border-top: 1px solid var(--border-color); display: flex; justify-content: space-around; align-items: center; z-index: 999; box-shadow: 0 -2px 10px rgba(0,0,0,0.03); padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 769px) { .mobile-bottom-nav { display: none; } }

.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 4px; width: 25%; position: relative; transition: var(--transition); }
.nav-item i { font-size: 1.3rem; }
.nav-item span { font-size: 0.65rem; font-weight: 600; }
.nav-item.active, .nav-item:hover { color: var(--primary-dark); }
.nav-item.active i { transform: translateY(-2px); }
.icon-wrap { position: relative; display: inline-flex; }
.nav-item .cart-badge { top: -6px; right: -10px; width: 16px; height: 16px; font-size: 0.65rem; }

/* Side Cart Slide-in */
.cart-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; opacity: 0; visibility: hidden; transition: var(--transition); }
.cart-sidebar { position: fixed; top: 0; left: -100%; width: 85%; max-width: 380px; height: 100%; height: 100dvh; background: white; z-index: 1001; box-shadow: 5px 0 25px rgba(0,0,0,0.1); display: flex; flex-direction: column; transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }
@media (min-width: 769px) { .cart-sidebar { left: -400px; width: 380px; } }
body.cart-open .cart-overlay { opacity: 1; visibility: visible; }
body.cart-open .cart-sidebar { left: 0; }

.cart-header { padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.cart-header h3 { font-size: 1.2rem; }
.close-cart { font-size: 1.5rem; color: var(--text-muted); }
.cart-items { flex: 1; overflow-y: auto; padding: 15px 20px; display: flex; flex-direction: column; gap: 15px; }
.cart-item { display: flex; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); }
.cart-item img { width: 65px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); }
.item-info { flex: 1; }
.item-info h4 { font-size: 0.9rem; margin-bottom: 4px; line-height: 1.3;}
.item-price { color: var(--primary-dark); font-weight: bold; margin-bottom: 5px; font-size: 0.95rem;}
.qty-controls { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-color); border-radius: 4px; padding: 2px 5px; width: fit-content; font-size: 0.85rem;}
.item-remove { color: #e74c3c; cursor: pointer; float: left; font-size: 0.9rem; margin-top: 5px;}
.empty-cart-msg { text-align: center; color: var(--text-muted); margin-top: 50px; font-size: 1rem;}

.cart-footer { padding: 15px 20px; border-top: 1px solid var(--border-color); background: var(--bg-main); padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
.cart-summary { display: flex; justify-content: space-between; font-size: 1.1rem; font-weight: 800; margin-bottom: 15px; color: var(--secondary); }
.checkout-btn { width: 100%; padding: 12px; background: var(--secondary); color: white; display: flex; justify-content: space-between; border-radius: var(--radius-sm); }

/* Footer */
.footer { background: var(--bg-white); border-top: 1px solid var(--border-color); padding-top: 40px; margin-bottom: calc(var(--nav-height) - 10px); }
@media (min-width: 769px) { .footer { margin-bottom: 0; padding-top: 60px; } }
.footer-grid { display: flex; flex-direction: column; gap: 30px; margin-bottom: 30px; text-align: center; }
@media (min-width: 769px) { .footer-grid { flex-direction: row; text-align: right; } }
.about-col p { color: var(--text-muted); margin: 15px 0; font-size: 0.9rem; }
.social-links { display: flex; justify-content: center; gap: 10px; }
@media (min-width: 769px) { .social-links { justify-content: flex-start; } }
.social-links a { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-main); display: flex; align-items: center; justify-content: center; color: var(--secondary); }
.footer-bottom { background: var(--secondary); color: white; padding: 15px 0; text-align: center; font-size: 0.85rem; }

/* Admin overrides for mobile */
@media (max-width: 768px) {
    .admin-main { flex: 1; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { flex-direction: column; text-align: center; padding: 15px; }
    .admin-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 10px; }
    .search-wrap { width: 100%; }
}

/* Enhanced Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 100000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal-card { background: white; padding: 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); width: 90%; max-width: 400px; text-align: center; }
.modal-overlay { overflow-y:auto; padding:16px; }
.modal-card { max-height:calc(100dvh - 32px); overflow-y:auto; }
.modal-card input,.modal-card select { font-size:16px; }
.modal-icon { font-size: 3.5rem; color: #ef4444; margin-bottom: 15px; }
.modal-title { font-size: 1.4rem; color: var(--secondary); margin-bottom: 10px; font-weight: 800;}
.modal-desc { color: var(--text-muted); margin-bottom: 25px; font-size: 1rem; line-height: 1.5;}
.modal-actions { display: flex; gap: 15px; }
.modal-btn { flex: 1; padding: 14px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: 0.2s; border: none; font-size: 1rem;}
.btn-cancel { background: #f1f5f9; color: #64748b; }
.btn-cancel:hover { background: #e2e8f0; }
.btn-confirm { background: #ef4444; color: white; }
.btn-confirm:hover { background: #dc2626; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3); }

/* Heartbeat Animation */
@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.3); }
    30% { transform: scale(1); }
    45% { transform: scale(1.3); }
    60% { transform: scale(1); }
}
.heartbeat { animation: heartbeat 1.5s infinite; display: inline-block; }

@media (max-width: 480px) {
    .container { padding-inline: 12px; }
    .header { padding: 8px 0; }
    .header-inner { gap: 10px; }
    .header-floral-logo { width: 112px !important; max-height: 55px; margin: 0 !important; }
    .search-bar { min-height: 44px; }
    .hero-section { padding: 25px 0 20px; }
    .hero-inner { gap: 18px; }
    .hero-content h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
    .hero-image-wrapper { max-width: 290px; }
    .hero-img { height:280px; }
    .floating-card { font-size: .75rem; }
    .c1 { right: 0; }
    .c2 { left: 0; }
    .products-grid { gap: 9px; padding: 0 10px; }
    .pro-img-box { height: clamp(145px, 48vw, 200px); }
    .pro-info { padding: 10px; }
    .pro-title { font-size: .9rem; }
    .pro-price { font-size: 1rem; }
    .mobile-bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
    body { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 10px); }
}

/* Entry Animations */
@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}
