/**
 * Remlek - Modern Dark Theme Design System
 * A premium, native app-like design system with gray shades and blue highlights
 */

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

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #141414;
    --bg-card-hover: #1c1c1c;
    --bg-elevated: #1f1f1f;

    /* Accent Colors - Gray Shades */
    --accent: #888888;
    --accent-light: #a0a0a0;
    --accent-dark: #606060;
    --accent-glow: rgba(136, 136, 136, 0.15);
    --accent-gradient: linear-gradient(135deg, #888888 0%, #606060 100%);

    /* Blue Accent (for buttons and highlights) */
    --blue: #3b82f6;
    --blue-light: #60a5fa;
    --blue-dark: #2563eb;
    --blue-glow: rgba(59, 130, 246, 0.2);
    --blue-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #666666;
    --text-muted: #4a4a4a;

    /* Border Colors */
    --border-primary: #2a2a2a;
    --border-secondary: #333333;
    --border-accent: rgba(136, 136, 136, 0.3);
    --border-blue: rgba(59, 130, 246, 0.3);

    /* Status Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    --font-size-5xl: 3rem;

    /* Font Weights */
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Border Radius - 5px */
    --radius-sm: 5px;
    --radius-md: 5px;
    --radius-lg: 5px;
    --radius-xl: 5px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(136, 136, 136, 0.2);
    --shadow-blue: 0 0 20px rgba(59, 130, 246, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-regular);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-bold);
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: var(--font-size-4xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-base);
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

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

a:hover {
    color: var(--blue-light);
}

/* ===== LAYOUT ===== */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-lg {
    max-width: 640px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-semibold);
    line-height: 1;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

/* Primary Button - Blue Gradient */
.btn-primary {
    background: var(--blue-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-md), var(--shadow-blue);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg), 0 0 30px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

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

/* Secondary Button - Outlined */
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-secondary);
}

.btn-secondary:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-glow);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Success Button */
.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #16a34a;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-xl);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--radius-full);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-secondary);
}

.card-glass {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-glow {
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.1);
    border-color: var(--border-blue);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-input {
    width: 100%;
    padding: var(--space-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px var(--blue-glow);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

/* File Input */
.form-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-file:hover {
    border-color: var(--blue);
    background: var(--blue-glow);
}

.form-file input[type="file"] {
    display: none;
}

/* ===== ALERTS & TOASTS ===== */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-medium);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info);
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-secondary);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-lg {
    width: 56px;
    height: 56px;
    border-width: 4px;
}

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

/* ===== PRODUCTS & STORE ===== */
.store-hero {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

.store-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.store-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, var(--bg-primary) 100%);
}

.store-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    margin-top: -40px;
    position: relative;
    z-index: 1;
}

.store-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 3px solid var(--bg-primary);
    background: var(--bg-card);
}

.store-name {
    font-size: var(--font-size-xl);
    font-weight: var(--font-bold);
}

.products-section {
    padding: var(--space-lg);
}

.products-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-lg);
    color: var(--text-secondary);
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.product-card:hover {
    border-color: var(--border-blue);
    box-shadow: var(--shadow-blue);
    transform: translateY(-4px);
}

.product-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.product-body {
    padding: var(--space-lg);
}

.product-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.product-desc {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: var(--font-size-xl);
    font-weight: var(--font-bold);
    color: var(--blue);
    margin-bottom: var(--space-md);
}

/* Affiliate Card */
.affiliate-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    margin: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-blue);
    border-radius: var(--radius-lg);
}

.affiliate-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.affiliate-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.affiliate-name {
    font-size: var(--font-size-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* Sticky Footer */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-top: 1px solid var(--border-primary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
}

.sticky-footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sticky-footer-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

.sticky-footer-phone {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-tertiary);
}

.text-accent {
    color: var(--accent);
}

.text-blue {
    color: var(--blue);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.text-xl {
    font-size: var(--font-size-xl);
}

.text-2xl {
    font-size: var(--font-size-2xl);
}

.font-light {
    font-weight: var(--font-light);
}

.font-medium {
    font-weight: var(--font-medium);
}

.font-semibold {
    font-weight: var(--font-semibold);
}

.font-bold {
    font-weight: var(--font-bold);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mt-xl {
    margin-top: var(--space-xl);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mb-xl {
    margin-bottom: var(--space-xl);
}

.pt-lg {
    padding-top: var(--space-lg);
}

.pb-lg {
    padding-bottom: var(--space-lg);
}

.py-lg {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
}

.px-lg {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

/* ===== ANIMATIONS ===== */
@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 slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.5s ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease infinite;
}

.animate-glow {
    animation: glow 2s ease infinite;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    :root {
        --font-size-4xl: 2rem;
        --font-size-3xl: 1.75rem;
    }

    .container {
        padding: 0 var(--space-md);
    }

    .btn-lg {
        padding: var(--space-md) var(--space-xl);
    }
}

/* Safe area for mobile */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sticky-footer {
        padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
    }

    body.page-with-footer {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

body.page-with-footer {
    padding-bottom: 100px;
}