/**
 * ============================================
 * RATIO-AI - Stili Principali
 * ============================================
 * 
 * Design system con variabili CSS, reset e componenti base.
 * Palette: Indigo/Violet/Cyan per look futuristico.
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Colori primari */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    
    /* Colori secondari (Violet) */
    --secondary-400: #a78bfa;
    --secondary-500: #8b5cf6;
    --secondary-600: #7c3aed;
    
    /* Colori accent (Cyan) */
    --accent-400: #22d3ee;
    --accent-500: #06b6d4;
    --accent-600: #0891b2;
    
    /* Colori success */
    --success-400: #34d399;
    --success-500: #10b981;
    --success-600: #059669;
    
    /* Colori error */
    --error-400: #f87171;
    --error-500: #ef4444;
    --error-600: #dc2626;
    
    /* Colori warning */
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    
    /* Grigi (Slate) */
    --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;
    
    /* Sfumature/Gradienti */
    --gradient-primary: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 50%, var(--accent-500) 100%);
    --gradient-primary-hover: linear-gradient(135deg, var(--primary-600) 0%, var(--secondary-600) 50%, var(--accent-600) 100%);
    --gradient-radial: radial-gradient(circle at 30% 30%, var(--primary-500), var(--secondary-600));
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */
    
    /* Spacing */
    --spacing-1: 0.25rem;  /* 4px */
    --spacing-2: 0.5rem;   /* 8px */
    --spacing-3: 0.75rem;  /* 12px */
    --spacing-4: 1rem;     /* 16px */
    --spacing-5: 1.25rem;  /* 20px */
    --spacing-6: 1.5rem;   /* 24px */
    --spacing-8: 2rem;     /* 32px */
    --spacing-10: 2.5rem;  /* 40px */
    --spacing-12: 3rem;    /* 48px */
    --spacing-16: 4rem;    /* 64px */
    
    /* Border radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgb(99 102 241 / 0.3);
    --shadow-glow-accent: 0 0 20px rgb(6 182 212 / 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Z-index */
    --z-dropdown: 100;
    --z-modal: 200;
    --z-tooltip: 300;
    --z-notification: 400;
}

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

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-900);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg {
    display: block;
    max-width: 100%;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

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

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

/* Remove default focus styles */
:focus {
    outline: none;
}

/* Custom focus styles */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

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 {
    margin-bottom: var(--spacing-4);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-6);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary button */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--gradient-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

/* Secondary button */
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--gray-300);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Large button */
.btn-large {
    padding: var(--spacing-4) var(--spacing-8);
    font-size: var(--font-size-lg);
}

/* Button arrow animation */
.btn-arrow {
    transition: transform var(--transition-base);
}

.btn:hover .btn-arrow {
    transform: translateX(4px);
}

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

.form-label {
    display: block;
    font-weight: 500;
    color: var(--gray-200);
    margin-bottom: var(--spacing-2);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--spacing-4);
    font-size: var(--font-size-base);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: white;
    transition: all var(--transition-base);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--gray-500);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: var(--error-500);
}

.form-input.valid,
.form-textarea.valid,
.form-select.valid {
    border-color: var(--success-500);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 48px;
}

.form-select option {
    background: var(--gray-800);
    color: white;
}

/* Form hint */
.form-hint {
    font-size: var(--font-size-sm);
    color: var(--gray-400);
    margin-top: var(--spacing-2);
}

/* Form error */
.form-error {
    font-size: var(--font-size-sm);
    color: var(--error-400);
    margin-top: var(--spacing-2);
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
}

/* ============================================
   CHECKBOX & RADIO
   ============================================ */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    padding: var(--spacing-4);
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
}

.checkbox-item:hover,
.radio-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.checkbox-item.selected,
.radio-item.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-500);
}

.checkbox-input,
.radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom,
.radio-custom {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-500);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.checkbox-custom {
    border-radius: var(--radius-sm);
}

.radio-custom {
    border-radius: 50%;
}

.checkbox-item.selected .checkbox-custom,
.radio-item.selected .radio-custom {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.checkbox-custom svg,
.radio-custom::after {
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-fast);
}

.checkbox-item.selected .checkbox-custom svg {
    opacity: 1;
    transform: scale(1);
}

.radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
}

.radio-item.selected .radio-custom::after {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label,
.radio-label {
    flex: 1;
    color: var(--gray-200);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

/* ============================================
   SLIDER / RANGE
   ============================================ */
.range-container {
    padding: var(--spacing-4) 0;
}

.range-input {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    appearance: none;
    cursor: pointer;
}

.range-input::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transition: transform var(--transition-fast);
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-input::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--spacing-2);
    font-size: var(--font-size-sm);
    color: var(--gray-400);
}

.range-value {
    text-align: center;
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--primary-400);
    margin-bottom: var(--spacing-4);
}

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

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

.text-primary { color: var(--primary-500); }
.text-secondary { color: var(--secondary-500); }
.text-accent { color: var(--accent-500); }
.text-success { color: var(--success-500); }
.text-error { color: var(--error-500); }
.text-muted { color: var(--gray-500); }

.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: var(--spacing-6); }
.mt-8 { margin-top: var(--spacing-8); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }
.mb-8 { margin-bottom: var(--spacing-8); }
