/**
 * Tunisia COD Theme - Design System
 * Modern, minimalist design tokens for Shopify-style UI
 * Version: 4.0
 */

/* ===========================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   =========================================== */

:root {
    /* ===== COLORS ===== */

    /* Primary Gradient (Purple → Blue) */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-gradient-hover: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);

    /* Solid Colors */
    --primary-color: #667eea;
    --primary-dark: #5a6fd6;
    --secondary-color: #764ba2;
    --accent-color: #52dbee;

    /* Backgrounds */
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-subtle: #f1f3f5;
    --bg-dark: #1a1a2e;

    /* Text */
    --text-dark: #1a1a2e;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;
    --text-white: #ffffff;

    /* Borders */
    --border-light: #e9ecef;
    --border-medium: #dee2e6;
    --border-dark: #ced4da;

    /* Status Colors */
    --success-color: var(--primary-color, #00b894);
    --success-bg: #d4edda;
    --warning-color: #fdcb6e;
    --warning-bg: #fff3cd;
    --danger-color: #d63031;
    --danger-bg: #f8d7da;
    --info-color: #0984e3;
    --info-bg: #cce5ff;

    /* Urgency Colors */
    --urgency-red: #e74c3c;
    --urgency-orange: #f39c12;
    --urgency-green: #27ae60;

    /* ===== SPACING ===== */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* ===== BORDER RADIUS ===== */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    /* ===== SHADOWS ===== */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.4);
    --shadow-glow-hover: 0 0 30px rgba(102, 126, 234, 0.6);

    /* ===== TYPOGRAPHY ===== */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-ar: 'Cairo', 'Tajawal', var(--font-family);

    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 30px;
    --font-size-4xl: 36px;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* ===== TRANSITIONS ===== */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* ===== ANIMATION DURATIONS ===== */
    --shine-duration: 2.5s;
    --pulse-duration: 2s;
    --countdown-pulse: 1s;

    /* ===== Z-INDEX ===== */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 400;
}

/* ===========================================
   GLOBAL RESET & BASE STYLES
   =========================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL Support for Arabic */
html[dir="rtl"] body,
body.rtl {
    font-family: var(--font-family-ar);
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */

/* Rounded Corners */
.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-2xl {
    border-radius: var(--radius-2xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

/* Shadows */
.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

/* Gradients */
.gradient-primary {
    background: var(--primary-gradient);
}

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===========================================
   BUTTON STYLES
   =========================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: inherit;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-white);
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-gradient-hover);
    box-shadow: var(--shadow-glow-hover);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Large Button */
.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-xl);
}

/* Full Width Button */
.btn-block {
    width: 100%;
}

/* ===========================================
   INPUT STYLES
   =========================================== */

.input-field {
    width: 100%;
    padding: var(--space-md);
    font-family: inherit;
    font-size: var(--font-size-md);
    color: var(--text-primary);
    background-color: var(--bg-white);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Select Dropdown */
.select-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23636e72' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: var(--space-2xl);
}

/* ===========================================
   CARD STYLES
   =========================================== */

.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.card-body {
    padding: var(--space-lg);
}

/* ===========================================
   PRODUCT IMAGE WITH SHINE EFFECT
   =========================================== */

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg-light);
}

.product-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--transition-slow);
}

.product-image-wrapper:hover img {
    transform: scale(1.03);
}

/* Shine Effect Overlay */
.product-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.4),
            transparent);
    animation: shine-sweep var(--shine-duration) infinite;
}

/* ===========================================
   PRICE DISPLAY
   =========================================== */

.price {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-dark);
}

.price-currency {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    margin-left: var(--space-xs);
}

.price-old {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: var(--space-sm);
}

/* ===========================================
   BADGES
   =========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-color);
}

.badge-warning {
    background: var(--warning-bg);
    color: #856404;
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-color);
}

.badge-urgency {
    background: var(--urgency-red);
    color: var(--text-white);
    animation: pulse var(--pulse-duration) infinite;
}

/* ===========================================
   QUANTITY SELECTOR
   =========================================== */

.quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: none;
    cursor: pointer;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.quantity-btn:hover {
    background: var(--primary-color);
    color: var(--text-white);
}

.quantity-input {
    width: 50px;
    height: 40px;
    text-align: center;
    border: none;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    -moz-appearance: textfield;
    appearance: textfield;
}

.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===========================================
   PAYMENT METHOD SELECTOR
   =========================================== */

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.payment-option {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.payment-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-white);
}

.payment-option.selected {
    border-color: var(--primary-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.payment-option input[type="radio"] {
    display: none;
}

.payment-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
}

.payment-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

/* ===========================================
   STICKY MOBILE BUTTON
   =========================================== */

.sticky-buy-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: var(--z-sticky);
    display: none;
}

@media (max-width: 768px) {
    .sticky-buy-btn {
        display: block;
    }

    .sticky-buy-btn .btn-primary {
        width: 100%;
    }
}

/* ===========================================
   RESPONSIVE BREAKPOINTS
   =========================================== */

@media (max-width: 1200px) {
    :root {
        --font-size-4xl: 32px;
        --font-size-3xl: 26px;
    }
}

@media (max-width: 768px) {
    :root {
        --font-size-4xl: 28px;
        --font-size-3xl: 24px;
        --font-size-2xl: 20px;
        --space-2xl: 32px;
        --space-3xl: 48px;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-4xl: 24px;
        --font-size-3xl: 20px;
        --font-size-2xl: 18px;
    }
}