/* ================================================================
   Vicmic Indonesia — Storefront Design System
   Clean green-themed, mobile-first, PWA-ready
   ================================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ── */
:root {
    /* Primary Green Palette (Vicmic brand) */
    --primary-50: #f0fdf4;
    --primary-100: #dcfce7;
    --primary-200: #bbf7d0;
    --primary-300: #86efac;
    --primary-400: #4ade80;
    --primary-500: #22c55e;
    --primary-600: #16a34a;
    --primary-700: #15803d;
    --primary-800: #166534;
    --primary-900: #14532d;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Surfaces */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(22, 163, 74, 0.15);

    /* Layout */
    --header-height: 64px;
    --container-max: 1280px;
    --container-padding: 16px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary-600); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-700); }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Layout ── */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.page-content {
    min-height: calc(100vh - var(--header-height) - 200px);
    padding-top: calc(var(--header-height) + 16px);
}

/* ── Header ── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    transition: box-shadow var(--transition-base);
}

.site-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    gap: 16px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-700);
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo img {
    height: 36px;
    width: auto;
}

.header-logo .logo-text {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Bar */
.header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.header-search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    outline: none;
}

.header-search input:focus {
    border-color: var(--primary-400);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-action-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    font-size: 1.2rem;
}

.header-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-600);
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--primary-600);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Mobile Menu Toggle */
.mobile-menu-btn {
    display: none;
}

/* ── Navigation (categories) ── */
.nav-categories {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.nav-categories-inner {
    display: flex;
    gap: 0;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.nav-cat-link {
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.nav-cat-link:hover, .nav-cat-link.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.btn-outline {
    background: transparent;
    color: var(--primary-600);
    border: 1.5px solid var(--primary-300);
}

.btn-outline:hover {
    background: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-700);
}

.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-full { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Product Card */
.product-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.product-card .card-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary);
}

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

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

.product-card .card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sale {
    background: var(--error);
    color: white;
}

.badge-new {
    background: var(--primary-600);
    color: white;
}

.badge-bestseller {
    background: var(--warning);
    color: var(--gray-900);
}

.product-card .card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-card .card-brand {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-card .card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-specs {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-price {
    margin-top: auto;
    padding-top: 8px;
}

.price-current {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-700);
}

.price-original {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 6px;
}

.price-discount {
    display: inline-block;
    padding: 2px 6px;
    background: #fef2f2;
    color: var(--error);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 6px;
}

.stock-indicator {
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 4px;
}

.stock-available { color: var(--success); }
.stock-low { color: var(--warning); }
.stock-out { color: var(--error); }

/* ── Product Grid ── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* ── Hero Section ── */
.hero {
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-700) 50%, var(--primary-500) 100%);
    color: white;
    padding: 48px 0;
    margin-top: var(--header-height);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.hero-tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    backdrop-filter: blur(4px);
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
}

.hero p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
    margin-bottom: 24px;
}

.hero .btn-primary {
    background: white;
    color: var(--primary-700);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.hero .btn-primary:hover {
    background: var(--gray-100);
    color: var(--primary-800);
    transform: translateY(-2px);
}

/* ── Section Titles ── */
.section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Category Cards ── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1.5px solid transparent;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.category-card:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-card .cat-icon {
    font-size: 2rem;
}

.category-card .cat-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.category-card .cat-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.form-textarea {
    min-height: 100px;
    padding: 12px 14px;
    resize: vertical;
}

.form-error {
    font-size: 0.75rem;
    color: var(--error);
    margin-top: 4px;
}

/* ── Cart Drawer ── */
.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: right var(--transition-slow);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    right: 0;
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.cart-drawer-header h3 {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
}

.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.cart-item-image {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 0.8125rem;
    color: var(--primary-600);
    font-weight: 600;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.qty-btn:hover {
    border-color: var(--primary-400);
    color: var(--primary-600);
}

.cart-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cart-total-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.cart-total-value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-700);
}

/* ── Skeleton Loading ── */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-text-sm { width: 60%; }
.skeleton-image { aspect-ratio: 1; }

/* ── Page Transitions ── */
.page-enter {
    opacity: 0;
    transform: translateY(8px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all var(--transition-base);
}

/* ── Footer ── */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 48px 0 24px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.footer-brand .footer-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-400);
    margin-bottom: 12px;
}

.footer-brand p {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--gray-400);
}

.footer-col h4 {
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
}

.footer-col a {
    font-size: 0.8125rem;
    color: var(--gray-400);
    transition: color var(--transition-fast);
}

.footer-col a:hover {
    color: var(--primary-400);
}

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 12px);
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: toast-slide-in 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); color: var(--gray-900); }

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    :root { --container-padding: 12px; }
    
    .hero h1 { font-size: 1.5rem; }
    .hero { padding: 32px 0; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    
    .header-search { display: none; }
    .mobile-menu-btn { display: flex; }

    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

    .section-title { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .product-card .card-body { padding: 8px; }
    .price-current { font-size: 0.875rem; }
}

/* ── Utility Classes ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
