/* =========================================
   STILE ACQUA - UNIFIED CORE STYLES
   Based on Apple Theme + Stile Acqua Branding
   ========================================= */

:root {
    /* Stile Acqua Brand Colors */
    --color-primary: #0288d1;
    /* Azzurro Acqua intenso */
    --color-primary-light: #03a9f4;
    /* Azzurro chiaro */
    --color-primary-dark: #01579b;
    /* Deep Blue */
    --color-accent: #0288d1;
    /* Used for Buttons (Apple Theme mapping) */
    --color-secondary: #00bcd4;
    /* Ciano brillante */

    /* Functional Colors */
    --color-success: #00c853;
    --color-warning: #ffab00;
    --color-error: #dc3545;

    /* Typography & UI */
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-bg: #f5f5f7;
    /* Apple-style light grey */
    --color-bg-card: #ffffff;
    --color-border: #d2d2d7;

    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Dimensions */
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-pill: 99px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* =========================================
   GLOBAL & LAYOUT
   ========================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

:focus {
    outline: none;
}

.configurator-container {
    background: var(--color-bg-card);
    max-width: 960px;
    margin: 40px auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.configurator-header {
    text-align: center;
    padding: 48px 32px 24px;
}

.configurator-header h1 {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    color: var(--color-primary);
}

.configurator-header p {
    font-size: 17px;
    color: var(--color-text-light);
    margin: 0;
    line-height: 1.4;
}

#configurator-content {
    padding: 40px 60px 48px;
}

/* =========================================
   PROGRESS BAR
   ========================================= */
.configurator-progress {
    padding: 0;
    margin-bottom: 30px;
}

.progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    width: 100%;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 10px rgba(2, 136, 209, 0.3);
}

.progress-steps {
    display: none;
}

/* =========================================
   FORM TYPOGRAPHY & FIELDS
   ========================================= */
.step-header {
    margin-bottom: 32px;
    text-align: center;
}

.step-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--color-primary);
}

.step-description {
    font-size: 17px;
    color: var(--color-text-light);
}

.field-label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text-light);
    margin-bottom: 15px;
    margin-top: 15px;
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    font-size: 17px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--color-text);
    transition: all 0.2s ease;
    appearance: none;
    font-family: var(--font-primary);
}

.field-textarea {
    height: auto;
    min-height: 120px;
    padding: 16px;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(2, 136, 209, 0.1);
}

/* Select Arrow */
.field-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    padding-right: 40px;
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* =========================================
   CARDS (Radios & Checkboxes)
   ========================================= */
.radio-group,
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.radio-option,
.checkbox-option {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    display: flex;
    align-items: center;
}

/* Hidden Input */
.radio-option input,
.checkbox-option input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* States */
.radio-option:hover,
.checkbox-option:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.radio-option:has(input:checked),
.checkbox-option:has(input:checked) {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
    background-color: rgba(2, 136, 209, 0.03);
}

/* Labels & Icons */
.radio-label,
.checkbox-label {
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Custom Check Circle/Box */
.radio-label::before,
.checkbox-label::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    margin-right: 10px;
    transition: 0.2s;
    flex-shrink: 0;
}

.checkbox-label::before {
    border-radius: 4px;
}

/* Checked Icon State */
.radio-option input:checked+.radio-label::before,
.checkbox-option input:checked+.checkbox-label::before {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.option-text {
    flex: 1;
}

.option-text strong {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
    margin-bottom: 2px;
}

.option-text small {
    display: block;
    font-size: 12px;
    color: var(--color-text-light);
}

.option-icon {
    font-size: 20px;
    margin-right: 10px;
    color: var(--color-primary);
}

/* =========================================
   RANGE SLIDER
   ========================================= */
.range-container {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.field-range {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #e2e8f0;
    border-radius: 5px;
    outline: none;
}

.field-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 0 0 4px #fff, 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

.field-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-value {
    background: var(--color-primary);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* =========================================
   PRIVACY DISCLAIMER
   ========================================= */
.privacy-disclaimer {
    text-align: center;
    padding: 16px 24px;
    margin: 20px auto 0;
    max-width: 500px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.privacy-disclaimer p {
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.5;
    margin: 0;
}

.privacy-disclaimer a {
    color: var(--color-primary);
    text-decoration: underline;
}

.privacy-disclaimer a:hover {
    color: var(--color-primary-dark);
}

/* =========================================
   NAVIGATION
   ========================================= */
.configurator-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 60px 40px;
    border-top: 1px solid var(--color-border);
    margin-top: 24px;
}

.btn {
    height: 48px;
    padding: 0 32px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(2, 136, 209, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(2, 136, 209, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-light);
}

.btn-secondary:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* =========================================
   INTERSTITIAL SCREEN (SAPEVI CHE...)
   ========================================= */
.interstitial-screen {
    text-align: center;
    padding: 20px 0;
    animation: fadeIn 0.5s ease forwards;
}

.interstitial-header {
    margin-bottom: 30px;
}

.interstitial-header h2 {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 10px;
    font-weight: 800;
}

.interstitial-header p {
    font-size: 1.1rem;
    color: var(--color-text-light);
}

.interstitial-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.interstitial-stat {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: transform 0.2s;
}

.interstitial-stat:hover {
    transform: translateY(-3px);
}

.interstitial-stat .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.interstitial-stat .stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-primary);
    margin: 10px 0 8px;
    display: block;
}

.interstitial-stat .stat-label {
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 600;
    display: block;
    text-transform: uppercase;
}

.interstitial-stat .stat-comparison {
    font-size: 0.85rem;
    color: var(--color-text);
    margin-top: 8px;
    font-style: italic;
    display: block;
}

/* =========================================
   OUTPUT PAGE - PREMIUM STYLE
   ========================================= */
.output-container {
    padding: 0;
}

.output-header {
    text-align: center;
    margin-bottom: 30px;
}

.output-header h2 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 10px;
}

.output-header p {
    color: var(--color-text-light);
    font-size: 1rem;
}

.success-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
    color: var(--color-success);
}

/* Monthly Rate Card */
.monthly-rate-card {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(2, 136, 209, 0.3);
    padding: 24px;
    margin-bottom: 24px;
    border-left: 4px solid var(--color-success);
    box-shadow: var(--card-shadow);
}

.benefit-card.bonus500 {
    border-left-color: #4caf50;
}

.benefit-card.iphone15 {
    border-left-color: #1d1d1f;
}

.benefit-card.bundle {
    border-left-color: #0288d1;
}

.benefit-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: white;
}

.benefit-badge.bonus500 {
    background: #4caf50;
}

.benefit-badge.iphone15 {
    background: #1d1d1f;
}

.benefit-badge.bundle {
    background: #0288d1;
}

.benefit-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.benefit-description {
    color: var(--color-text-light);
    font-size: 1rem;
}

.benefit-items {
    list-style: none;
    padding: 0;
    margin-top: 16px;
}

.benefit-items li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-weight: 600;
    color: var(--color-text);
}

.benefit-items li::before {
    content: "✓";
    color: var(--color-success);
    font-weight: bold;
}

/* Savings Section */
.savings-section {
    background: rgba(0, 200, 83, 0.05);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 200, 83, 0.2);
}

.savings-section h3 {
    color: var(--color-success);
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.savings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.savings-item {
    text-align: center;
}

.savings-item .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-success);
    display: block;
}

.savings-item .label {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* Data Summary */
.data-summary {
    background: #f9fafb;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 20px 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    color: var(--color-text-light);
    font-weight: 500;
    font-size: 0.95rem;
}

.summary-value {
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: right;
}

/* Summary Card wrapper */
.summary-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--color-border);
}

.summary-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--color-primary);
}

/* Next Steps */
.output-next-steps {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--color-border);
}

.output-next-steps h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--color-primary);
}

.output-next-steps ol {
    margin: 16px 0;
    padding-left: 24px;
}

.output-next-steps li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--color-text);
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step {
    display: none;
    animation: fadeIn 0.5s ease forwards;
}

.step.active {
    display: block;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {

    .radio-group,
    .checkbox-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .configurator-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        box-shadow: none;
    }

    #configurator-content {
        padding: 24px;
    }

    .configurator-navigation {
        padding: 24px;
        flex-direction: column-reverse;
        gap: 12px;
    }

    .btn {
        width: 100%;
    }

    .interstitial-stats,
    .savings-grid {
        grid-template-columns: 1fr;
    }

    .monthly-rate-value {
        font-size: 2.5rem;
    }
}

@media (max-width: 600px) {

    .radio-group,
    .checkbox-group {
        grid-template-columns: 1fr;
    }
}