/* RafaiEggs Modern E-Commerce Design System */
/* WebView Specific Optimizations */
.is-webview {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}
.is-webview input, .is-webview textarea {
    user-select: auto;
}

:root {
    --primary: #0d6efd;
    --primary-hover: #0a58ca;
    --primary-light: rgba(13, 110, 253, 0.1);
    
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0dcaf0;
    
    --dark: #212529;
    --dark-surface: #2b3035;
    --light: #f8f9fa;
    --white: #ffffff;
    
    --text-main: #333333;
    --text-muted: #6c757d;
    --text-light: #adb5bd;
    
    --border-color: #dee2e6;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --light: #020617; /* Slate 950 */
    --white: #0f172a; /* Slate 900 */
    --dark: #f8f9fa;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: rgba(255,255,255,0.08);
    --dark-surface: #1e293b;
    --primary-light: rgba(13, 110, 253, 0.15);
}

/* Premium Theme (Royal Navy) */
[data-theme="premium"] {
    --light: #0c192e;
    --white: #162a4a;
    --dark: #e0e7ff;
    --text-main: #e0e7ff;
    --text-muted: #94a3b8;
    --border-color: #1e3a8a;
    --dark-surface: #1e3a8a;
    --primary: #fbbf24;
    --primary-hover: #f59e0b;
}

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

body {
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--light);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: 90px;
    transition: background-color 0.3s ease;
}

.pb-safe {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
}

.pt-safe {
    padding-top: env(safe-area-inset-top, 0px);
}

.mt-safe {
    margin-top: env(safe-area-inset-top, 0px);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul { list-style: none; }

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

@media (max-width: 600px) {
    .container { max-width: 100%; }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-main);
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }

/* Bottom Navigation — Always Dark */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f172a;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 70px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

@media (min-width: 1024px) {
    .bottom-nav { display: none !important; }
    body { padding-bottom: 0; }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #64748b;
    font-size: 9px;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 6px 4px;
    border-radius: 12px;
    flex: 1;
}
.nav-item i { font-size: 20px; margin-bottom: 3px; transition: transform 0.2s ease; }
.nav-item.active {
    color: var(--primary);
    text-shadow: 0 0 12px var(--primary);
}
.nav-item.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 6px var(--primary));
}
.nav-item:not(.active):hover { color: #94a3b8; }

/* Sidebar & Overlay (Prep Style) */
.sidebar {
    width: 260px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--white);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
}

.sidebar.sidebar-compact { width: 80px; }

@media (min-width: 1024px) {
    .content-with-sidebar {
        margin-left: 260px;
        width: calc(100% - 260px);
    }
    .content-with-sidebar.compact-offset {
        margin-left: 80px;
        width: calc(100% - 80px);
    }
}

@media (max-width: 1024px) {
    .sidebar { left: -260px; }
    .sidebar.active { left: 0; box-shadow: var(--shadow-lg); }
    .content-with-sidebar { margin-left: 0 !important; width: 100% !important; }
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin: 2px 0;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}
.sidebar-link i { width: 20px; text-align: center; font-size: 18px; }
.sidebar-link:hover, .sidebar-link.active { 
    background: var(--primary-light); 
    color: var(--primary); 
    padding-left: 24px;
}

.sidebar-divider { height: 1px; background: var(--border-color); margin: 12px 16px; opacity: 0.5; }
.sidebar-text { white-space: nowrap; transition: opacity 0.2s; }
.sidebar-compact .sidebar-text { display: none; }

/* Utility Classes */
.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.flex-1 { flex: 1 !important; }
.items-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-2 { gap: 8px !important; }
.relative { position: relative !important; }
.w-full { width: 100% !important; }

@media (min-width: 1024px) {
    .lg\:hidden { display: none !important; }
    .lg\:flex { display: flex !important; }
}

.ml-1 { margin-left: 4px !important; }
.ml-2 { margin-left: 8px !important; }
.mr-2 { margin-right: 8px !important; }
.mt-4 { margin-top: 16px !important; }
.mb-6 { margin-bottom: 24px !important; }
.mb-8 { margin-bottom: 32px !important; }
.p-2 { padding: 8px !important; }
.p-4 { padding: 16px !important; }
.p-6 { padding: 24px !important; }
.px-4 { padding-left: 16px !important; padding-right: 16px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
.space-y-1 > * + * { margin-top: 4px !important; }

/* Product Tile Enhancements */
.product-card {
    position: relative;
    padding: 12px !important;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    background: var(--white);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.product-image-container {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--light);
    margin-bottom: 12px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--success);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 8px;
    z-index: 10;
}

.wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    color: var(--danger);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
}

.wishlist-btn:hover {
    background: var(--white);
    transform: scale(1.1);
}

.product-details {
    flex: 1;
}

.product-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.product-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-unit {
    font-size: 10px;
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.product-pricing {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
}

.current-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.original-price {
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.save-amount {
    font-size: 9px;
    font-weight: 800;
    color: var(--success);
    background: rgba(25, 135, 84, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 10px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
    margin-top: auto;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--white) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}
@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
