/* ═══════════════════════════════════════════════════════════════
   VisualStudio — Global Design System
   Light pastel theme inspired by dreams-store.com
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Design Tokens) ──────────────────── */
:root {
    /* Primary palette (Purple) */
    --color-primary: #8b5cf6;
    --color-primary-light: #a78bfa;
    --color-primary-dark: #7c3aed;
    --color-primary-glow: rgba(139, 92, 246, 0.2);

    /* Accent (Teal/Turquoise) */
    --color-accent: #2dd4bf;
    --color-accent-light: #5eead4;
    --color-accent-glow: rgba(45, 212, 191, 0.2);

    /* Success / Warning / Danger */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    /* Neutrals (Light cream/pastel theme) */
    --color-bg-deep: #FDFBF7;
    --color-bg: #FFFDF9;
    --color-bg-elevated: #ffffff;
    --color-bg-card: rgba(255, 255, 255, 0.95);
    --color-border: rgba(139, 92, 246, 0.15);
    --color-border-hover: rgba(139, 92, 246, 0.3);

    /* Text */
    --color-text: #1f2937;
    --color-text-muted: #4b5563;
    --color-text-dim: #9ca3af;

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-bg-hover: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(139, 92, 246, 0.15);
    --glass-blur: 16px;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(139, 92, 246, 0.05);
    --shadow-md: 0 4px 12px rgba(139, 92, 246, 0.1);
    --shadow-lg: 0 8px 32px rgba(139, 92, 246, 0.15);
    --shadow-glow: 0 0 30px var(--color-primary-glow);

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

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Legacy aliases for blade templates */
    --c-accent-primary: var(--color-primary);
    --c-accent-secondary: var(--color-accent);
    --c-bg-surface: var(--color-bg);
    --c-bg-elevated: var(--color-bg-elevated);
    --c-text-primary: var(--color-text);
    --c-text-secondary: var(--color-text-muted);
    --c-text-tertiary: var(--color-text-dim);
    --text-muted: var(--color-text-muted);
    --radius-pill: var(--radius-full);
    --t-fast: var(--transition-fast);
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 3rem;
}

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

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

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-deep);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background gradient removed for clean pastel look */
body::before {
    content: none;
}

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

a:hover {
    color: var(--color-primary-dark);
}

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

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

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

/* ── Glass Card ─────────────────────────────────────────────── */
.glass-card {
    background: #ffffff;
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 16px rgba(139, 92, 246, 0.08);
    transition: all var(--transition-base);
    padding: var(--space-xl);
}

.glass-card:hover {
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.14);
    transform: translateY(-2px);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
    box-shadow: 0 4px 20px var(--color-primary-glow);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--color-text);
    border-color: var(--glass-border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: #f3f0ff;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #dc2626);
    color: white;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
    width: 2.25rem;
    height: 2.25rem;
}

/* ── Inputs ─────────────────────────────────────────────────── */
.input, .select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #faf8ff;
    border: 1.5px solid #e5e2ef;
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    outline: none;
}

.input:focus, .select:focus, textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Layout Utilities ───────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

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

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-cols-4, .grid-cols-3, .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--color-text-muted); }
.text-dim { color: var(--color-text-dim); }
.font-mono { font-family: var(--font-mono); }
.relative { position: relative; }
.z-10 { z-index: 10; }

.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-hidden { overflow: hidden; }
.hidden { display: none; }

/* ── Navigation ─────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--space-md) 0;
    background: #8b5cf6;
    border-bottom: none;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    list-style: none;
}

.navbar-nav a {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.navbar-nav a:hover {
    color: var(--color-text);
}

/* ── Product Cards ──────────────────────────────────────────── */
.product-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid rgba(139, 92, 246, 0.1);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.06);
    transition: all var(--transition-base);
}

.product-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.18);
    transform: translateY(-6px);
}

.product-card__image {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--color-bg);
    position: relative;
}

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

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

.product-card__image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, var(--color-bg-card), transparent);
    pointer-events: none;
}

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

.product-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.product-card__meta {
    font-size: 0.8125rem;
    color: var(--color-text-dim);
}

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
    border-color: rgba(99, 102, 241, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border-color: rgba(245, 158, 11, 0.3);
}

/* ── Toast / Alert ──────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 9999;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--color-bg-elevated);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

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

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 3px;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    background: var(--color-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.25s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

/* ── Table ──────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-dim);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
}

.table td {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.table tr:hover td {
    background: var(--glass-bg);
}

.table tr:last-child td {
    border-bottom: none;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

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

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px var(--color-primary-glow); }
    50% { box-shadow: 0 0 40px var(--color-primary-glow), 0 0 60px rgba(99, 102, 241, 0.15); }
}

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

.animate-fade-in { animation: fadeIn 0.5s ease-out; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease-out both; }
.animate-pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }
.animate-float { animation: float 4s ease-in-out infinite; }

/* Stagger animation delays for grid children */
.stagger > :nth-child(1) { animation-delay: 0ms; }
.stagger > :nth-child(2) { animation-delay: 80ms; }
.stagger > :nth-child(3) { animation-delay: 160ms; }
.stagger > :nth-child(4) { animation-delay: 240ms; }
.stagger > :nth-child(5) { animation-delay: 320ms; }
.stagger > :nth-child(6) { animation-delay: 400ms; }
.stagger > :nth-child(7) { animation-delay: 480ms; }
.stagger > :nth-child(8) { animation-delay: 560ms; }

/* ── Color Swatch ───────────────────────────────────────────── */
.color-swatch {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--color-text);
}

/* ── File Drop Zone ─────────────────────────────────────────── */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-2xl);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
}

.dropzone svg {
    width: 3rem;
    height: 3rem;
    color: var(--color-text-dim);
}

/* ── QR Display ─────────────────────────────────────────────── */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-2xl);
}

.qr-image {
    width: 200px;
    height: 200px;
    padding: var(--space-md);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* ── Editor Layout ──────────────────────────────────────────── */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.editor-canvas {
    position: relative;
    background: var(--color-bg);
    overflow: hidden;
}

.editor-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.editor-sidebar {
    background: var(--color-bg-elevated);
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.editor-section {
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.editor-section:last-child {
    border-bottom: none;
}

.editor-section h3 {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh 1fr;
    }

    .editor-sidebar {
        border-left: none;
        border-top: 1px solid var(--color-border);
    }
}

/* ── Slider ─────────────────────────────────────────────────── */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--color-bg);
    border-radius: var(--radius-full);
    outline: none;
    border: 1px solid var(--color-border);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid var(--color-primary-light);
    box-shadow: 0 0 8px var(--color-primary-glow);
    transition: all var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 16px var(--color-primary-glow);
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    cursor: pointer;
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius-md) - 3px);
}

/* ── WebAR Fullscreen ───────────────────────────────────────── */
.webar-container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow: hidden;
    background: #000;
}

.webar-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.webar-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    padding: var(--space-lg);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.webar-loading {
    position: fixed;
    inset: 0;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    background: var(--color-bg-deep);
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-dim);
}

/* ── Selection ──────────────────────────────────────────────── */
::selection {
    background: var(--color-primary);
    color: white;
}

/* ── Stats Card ─────────────────────────────────────────────── */
.stat-card {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid rgba(139, 92, 246, 0.1);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.06);
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-card__label {
    font-size: 0.8125rem;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    text-align: center;
    gap: var(--space-md);
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    color: var(--color-text-dim);
    margin-bottom: var(--space-md);
}
