/* ============================================
   RAIO-X IFOOD - PREMIUM UI SYSTEM
   Modern, Consistent, Engaging
   ============================================ */

/* === VARIABLES === */
:root {
    /* Colors */
    --primary: #E63946;
    --primary-dark: #C41E3A;
    --primary-light: #FF6B7A;
    --secondary: #1D3557;
    --secondary-light: #2D4A6F;
    --accent: #457B9D;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --danger: #EF4444;
    
    /* Neutrals */
    --white: #FFFFFF;
    --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;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-dark: linear-gradient(180deg, var(--gray-900) 0%, var(--secondary) 100%);
    --gradient-card: linear-gradient(180deg, var(--white) 0%, var(--gray-50) 100%);
    --gradient-success: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(230, 57, 70, 0.3);
    --shadow-glow-success: 0 0 40px rgba(16, 185, 129, 0.3);
    
    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --container: 400px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--gray-900);
    color: var(--gray-100);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === PROGRESS BAR === */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.5s var(--ease-out);
}

/* === STEP INDICATOR === */
.step-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.step-indicator.visible {
    opacity: 1;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-600);
    transition: all 0.3s ease;
}

.step.active .step-dot {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.step.completed .step-dot {
    background: var(--success);
}

.step-line {
    width: 20px;
    height: 2px;
    background: var(--gray-700);
}

/* === LAYOUT === */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
}

.screen {
    position: fixed;
    inset: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
    overflow-y: auto;
    background: var(--gray-900);
}

.screen.active {
    display: block;
    opacity: 1;
}

.screen-content {
    width: 100%;
    animation: slideUp 0.5s var(--ease-out);
}

.screen-content.center {
    text-align: center;
}

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

/* === TYPOGRAPHY === */
h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lead {
    font-size: 1.125rem;
    color: var(--gray-400);
    margin-bottom: 32px;
    line-height: 1.6;
}

.helper-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* === BUTTONS === */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 28px;
    background: var(--gradient-primary);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    box-shadow: var(--shadow-lg), 0 4px 20px rgba(230, 57, 70, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 8px 30px rgba(230, 57, 70, 0.5);
}

.btn-primary:hover::before {
    opacity: 1;
}

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

.btn-primary.loading {
    pointer-events: none;
}

.btn-primary.loading span {
    opacity: 0;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s var(--ease-spring);
}

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

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    background: transparent;
    color: var(--gray-400);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    margin-top: 12px;
    transition: color 0.2s ease;
}

.btn-ghost:hover {
    color: var(--gray-200);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 24px;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.back-button:hover {
    color: var(--gray-200);
}

.back-button svg {
    width: 18px;
    height: 18px;
}

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

/* === ICON BADGE === */
.icon-badge {
    width: 80px;
    height: 80px;
    background: var(--secondary-light);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.icon-badge.success {
    background: rgba(16, 185, 129, 0.15);
}

.icon-emoji {
    font-size: 2.5rem;
}

/* === TRUST BADGES === */
.trust-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-800);
}

.badge {
    text-align: center;
}

.badge-number {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--white);
}

.badge-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.badge-divider {
    width: 1px;
    height: 32px;
    background: var(--gray-700);
}

/* === SLIDER === */
.slider-container {
    margin-bottom: 40px;
}

.slider-value-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.hours-input {
    font-family: var(--font);
    font-size: 4rem;
    font-weight: 900;
    color: var(--white);
    background: transparent;
    border: none;
    width: 140px;
    text-align: right;
    outline: none;
    -moz-appearance: textfield;
}

.hours-input::-webkit-outer-spin-button,
.hours-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.hours-suffix {
    font-size: 1.25rem;
    color: var(--gray-500);
    font-weight: 500;
}

.slider-wrapper {
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
}

#hours-slider {
    position: absolute;
    width: 100%;
    height: 48px;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 8px;
    background: var(--gray-700);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.slider-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 50%;
    border-radius: var(--radius-full);
    transition: width 0.1s ease;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* === QUESTION HEADER === */
.question-header {
    margin-bottom: 16px;
}

.question-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
}

.question-total {
    font-size: 1rem;
    color: var(--gray-600);
    margin-left: 4px;
}

/* === LOADING === */
.loading-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
}

.loading-circle {
    position: absolute;
    inset: 0;
    border: 3px solid var(--gray-700);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.loading-text {
    margin-bottom: 32px;
}

.loading-steps {
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--gray-500);
    transition: color 0.3s ease;
}

.loading-step.active {
    color: var(--white);
}

.loading-step.done {
    color: var(--success);
}

.step-check {
    font-size: 1rem;
    width: 20px;
}

.loading-step.done .step-check::before {
    content: '✓';
}

/* === RESULTS === */
.result-header {
    margin-bottom: 24px;
}

.result-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    background: rgba(230, 57, 70, 0.1);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    margin-bottom: 12px;
}

.result-card-main {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-glow);
}

.result-highlight {
    text-align: center;
}

.highlight-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    margin-bottom: 8px;
}

.highlight-value {
    display: block;
    font-size: 4rem;
    font-weight: 900;
    color: var(--white);
    line-height: 1;
}

.highlight-unit {
    display: block;
    font-size: 1rem;
    color: rgba(255,255,255,0.8);
    margin-top: 8px;
}

.result-breakdown {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.breakdown-item {
    flex: 1;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
}

.breakdown-item.featured {
    background: rgba(230, 57, 70, 0.15);
    border: 1px solid rgba(230, 57, 70, 0.3);
}

.breakdown-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.breakdown-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--white);
}

.breakdown-label {
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* === DONUT CHART === */
.result-visual {
    background: var(--gray-800);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
}

.visual-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 20px;
    text-align: center;
}

.donut-chart {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 20px;
}

.donut {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-ring {
    fill: none;
    stroke: var(--gray-700);
    stroke-width: 12;
}

.donut-segment-you {
    fill: none;
    stroke: var(--success);
    stroke-width: 12;
    stroke-dasharray: 0 251.2;
    stroke-linecap: round;
    transition: stroke-dasharray 1s var(--ease-out);
}

.donut-segment-ifood {
    fill: none;
    stroke: var(--primary);
    stroke-width: 12;
    stroke-dasharray: 0 251.2;
    stroke-linecap: round;
    transition: stroke-dasharray 1s var(--ease-out);
}

.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-percent {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
}

.donut-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.visual-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-400);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.ifood {
    background: var(--primary);
}

.legend-dot.you {
    background: var(--success);
}

/* === CTA SCREEN === */
.cta-benefits {
    margin-bottom: 32px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--gray-300);
}

.benefit-icon {
    width: 24px;
    height: 24px;
    color: var(--success);
    flex-shrink: 0;
}

/* === FORM === */
.form {
    margin-top: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-300);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 16px 20px;
    font-family: var(--font);
    font-size: 1rem;
    color: var(--white);
    background: var(--gray-800);
    border: 2px solid var(--gray-700);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.1);
}

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

.time-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.time-option input {
    display: none;
}

.time-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: var(--gray-800);
    border: 2px solid var(--gray-700);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-option input:checked + .time-card {
    border-color: var(--primary);
    background: rgba(230, 57, 70, 0.1);
}

.time-icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.time-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--white);
}

.time-range {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* === SUCCESS === */
.success-animation {
    margin-bottom: 24px;
}

.success-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.checkmark {
    width: 100%;
    height: 100%;
}

.checkmark-circle {
    stroke: var(--success);
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.6s var(--ease-out) forwards;
}

.checkmark-check {
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s var(--ease-out) 0.4s forwards;
}

@keyframes stroke {
    to { stroke-dashoffset: 0; }
}

.success-summary-card {
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 24px 0;
    text-align: left;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 600;
}

.summary-icon {
    font-size: 1rem;
}

.summary-content {
    padding: 20px;
}

.summary-content p {
    font-size: 0.9rem;
    color: var(--gray-400);
    line-height: 1.6;
}

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

.next-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.next-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.next-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--gray-800);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
}

/* === MODAL === */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: var(--gray-800);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 380px;
    width: 100%;
    animation: slideUp 0.3s var(--ease-spring);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--gray-700);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-600);
}

.modal-close svg {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.modal-subtitle {
    color: var(--gray-400);
    margin-bottom: 24px;
}

.projection-visual {
    margin: 24px 0;
}

.projection-bar {
    height: 24px;
    background: var(--gray-700);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.projection-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--danger) 100%);
    width: 0%;
    transition: width 1s var(--ease-out);
}

.projection-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.projection-stats {
    margin-bottom: 24px;
}

.projection-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-700);
}

.projection-stat.featured {
    border: none;
    background: rgba(16, 185, 129, 0.1);
    margin: 0 -32px;
    padding: 16px 32px;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray-400);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
}

.stat-value.danger {
    color: var(--danger);
}

.stat-value.success {
    color: var(--success);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === CONFETTI === */
#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1001;
}

/* === RESPONSIVE === */
@media (max-width: 380px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    .hours-input { font-size: 3rem; width: 100px; }
    .highlight-value { font-size: 3rem; }
    .result-breakdown { flex-direction: column; }
    .time-options { grid-template-columns: 1fr; }
    .trust-badges { flex-wrap: wrap; gap: 12px; }
    .badge-divider { display: none; }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
