/* =========================================================
   IGEC E-Commerce — Global Design System
   ========================================================= */

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

/* =========================================================
   1. Design Tokens (CSS Custom Properties)
   ========================================================= */
:root {
    /* Primary Palette — Emerald */
    --primary: #059669;
    --primary-dark: #047857;
    --primary-darker: #065f46;
    --primary-light: #10b981;
    --primary-lighter: #d1fae5;
    --primary-ghost: #ecfdf5;

    /* Accent */
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-ghost: #eef2ff;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;

    /* Surface */
    --bg-primary: #f8faf9;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-glass: rgba(255, 255, 255, 0.8);

    /* Text */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;

    /* Borders */
    --border-light: #e5e7eb;
    --border-default: #d1d5db;
    --border-focus: #059669;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 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-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-primary: 0 4px 14px rgba(5, 150, 105, 0.25);
    --shadow-card-hover: 0 20px 40px rgba(5, 150, 105, 0.12);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Z-index scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-nav: 1000;
    --z-modal-backdrop: 1100;
    --z-modal: 1200;
    --z-toast: 1300;
}

/* =========================================================
   2. Global Reset & Base
   ========================================================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* =========================================================
   3. Typography Utilities
   ========================================================= */
.heading-xl {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.heading-lg {
    font-family: var(--font-heading);
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.heading-md {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

.heading-sm {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* =========================================================
   4. Animation Keyframes Library
   ========================================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8); }
    70% { transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

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

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-heading {
    height: 24px;
    width: 70%;
    margin-bottom: 12px;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1;
}

.skeleton-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* =========================================================
   6. Glassmorphism Utilities
   ========================================================= */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =========================================================
   7. Button Styles
   ========================================================= */
.btn-global {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn-global::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10.01%);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

.btn-global:active::after {
    transform: scale(10);
    opacity: 1;
    transition: 0s;
}

.btn-primary-g {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-primary);
}

.btn-primary-g:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
}

.btn-primary-g:active {
    transform: translateY(0);
}

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

.btn-outline-g:hover {
    background: var(--primary-ghost);
    transform: translateY(-1px);
}

.btn-danger-g {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.btn-danger-g:hover {
    background: var(--danger);
    color: white;
}

/* =========================================================
   8. Badge Styles
   ========================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--primary-lighter);
    color: var(--primary-dark);
}

.badge-accent {
    background: var(--accent-ghost);
    color: var(--accent);
}

.badge-new {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

/* =========================================================
   9. Toast Notification System
   ========================================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary);
    animation: fadeInRight var(--duration-slow) var(--ease-spring);
    pointer-events: auto;
    max-width: 380px;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

/* =========================================================
   10. Scroll Reveal (Intersection Observer targets)
   ========================================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* =========================================================
   11. Input Styles
   ========================================================= */
.input-modern {
    width: 100%;
    padding: 14px 16px;
    background: var(--gray-50);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all var(--duration-normal) var(--ease-out);
}

.input-modern:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.input-modern::placeholder {
    color: var(--text-muted);
}

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

.input-with-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    transition: color var(--duration-fast);
    z-index: 1;
}

.input-with-icon input,
.input-with-icon textarea {
    padding-left: 44px;
}

.input-with-icon:focus-within i {
    color: var(--primary);
}

/* =========================================================
   12. Card Utilities
   ========================================================= */
.card-base {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.card-base:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(5, 150, 105, 0.2);
    transform: translateY(-4px);
}

/* =========================================================
   13. Loading Spinner
   ========================================================= */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* =========================================================
   14. Responsive Utilities
   ========================================================= */
.desktop-only {
    display: none;
}

.mobile-only {
    display: block;
}

@media (min-width: 768px) {
    .desktop-only { display: block; }
    .mobile-only { display: none; }
}

/* Hide scrollbar but keep functionality */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* =========================================================
   15. Page Transition
   ========================================================= */
.page-enter {
    animation: fadeInUp 0.4s var(--ease-out);
}

/* =========================================================
   16. Accessibility
   ========================================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible ring */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* =========================================================
   17. Image Lazy Load Fade-In
   ========================================================= */
.lazy-img {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lazy-img.loaded {
    opacity: 1;
}

/* Prevent layout shift */
.img-container {
    position: relative;
    overflow: hidden;
    background: var(--gray-100);
}
