/* Reset e impostazioni di base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Minimal Header */
.minimal-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.site-logo {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-tagline {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.back-link {
    display: inline-block;
    color: #000;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-5px);
}

/* Grid dei telefoni */
main {
    padding: 2rem 0 3rem;
    flex: 1; /* Questa riga fa crescere il main per riempire lo spazio */
}

.phones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.75rem;
    margin-top: 3rem;
}

.phone-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.phone-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.phone-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background: #f8fafc;
}

.phone-info {
    padding: 1rem;
}

.phone-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.phone-memory {
    display: inline-block;
    background: #f1f5f9;
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.phone-price-container {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.phone-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.phone-price-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-select {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.btn-select:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

/* Landing page */
.landing-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-top: 2rem;
}

.phone-summary {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.phone-summary img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.phone-summary h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.phone-summary .memory-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.phone-summary .price-info {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.phone-summary .price-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.phone-summary .price-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Form */
.form-container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-container h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Progress Indicator */
.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.progress-step {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: var(--primary-color);
    color: white;
}

.progress-step.completed {
    background: var(--secondary-color);
    color: white;
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Step Navigation */
.step-navigation {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-prev, .btn-next {
    flex: 1;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-prev {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-prev:hover:not(:disabled) {
    background: #cbd5e1;
}

.btn-next {
    background: var(--primary-color);
    color: white;
}

.btn-next:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-prev:disabled, .btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group select {
    cursor: pointer;
    background-color: white;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: auto;
    cursor: pointer;
    margin: 0;
}

.radio-label:hover {
    color: var(--primary-color);
}

/* Error Message */
.error-message {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
    font-weight: 600;
    font-size: 0.875rem;
}

.checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-top: 0.25rem;
    cursor: pointer;
}

.btn-submit {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
    font-weight: 600;
}

.form-message.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.form-message.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 4rem;
}

/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    padding: 1.5rem;
    animation: slideUp 0.3s ease;
    transition: opacity 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.cookie-banner-text h3 {
    font-size: 1.125rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.cookie-banner-text p {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.cookie-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-size: 0.875rem;
    font-weight: 500;
}

.cookie-link:hover {
    color: var(--primary-hover);
}

.cookie-banner-actions {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.btn-cookie {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-cookie.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-cookie.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-cookie.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-cookie.btn-secondary:hover {
    background: #cbd5e1;
}

@media (max-width: 768px) {
    .cookie-banner {
        padding: 1rem;
    }
    
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .cookie-banner-actions {
        flex-direction: column;
    }
    
    .btn-cookie {
        width: 100%;
    }
}

/* Admin Panel - Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Admin Panel - Phone Item States */
.phone-item-inactive {
    opacity: 0.6;
    background: #f9fafb !important;
}

.phone-item-inactive .phone-item-image {
    filter: grayscale(0.5);
}

/* Admin Panel - Toggle Buttons */
.btn-toggle {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-toggle.btn-deactivate {
    background: #fef3c7;
    color: #92400e;
}

.btn-toggle.btn-deactivate:hover {
    background: #fde68a;
}

.btn-toggle.btn-activate {
    background: #d1fae5;
    color: #065f46;
}

.btn-toggle.btn-activate:hover {
    background: #a7f3d0;
}

/* Desktop wide grid */
@media (min-width: 1200px) {
    .phones-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive */
@media (max-width: 768px) {
    /* Header Mobile */
    .minimal-header {
        padding: 1rem 0;
    }

    .site-logo {
        font-size: 1.25rem;
    }

    .header-tagline {
        font-size: 0.75rem;
    }

    /* Main mobile: mantiene lo stesso spacing di desktop */

    .phones-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.25rem;
    }

    /* Landing */
    .landing-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .phone-summary {
        position: static;
        order: 1;
        padding: 0.875rem 1rem;
        background: var(--primary-color);
        color: white;
        text-align: center;
    }
    
    .phone-summary img {
        display: none !important;
    }
    
    .phone-summary .memory-badge,
    .phone-summary .price-info {
        display: none !important;
    }
    
    .phone-summary h3 {
        font-size: 1.125rem;
        color: white;
        margin: 0;
    }

    .form-container {
        padding: 1.5rem;
        order: 2;
    }

    .form-container h2 {
        font-size: 1.5rem;
    }

    .radio-group {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    /* Header Small Mobile */
    .minimal-header {
        padding: 0.875rem 0;
    }

    .site-logo {
        font-size: 1.125rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    /* Landing Mobile */
    .landing-container {
        display: flex;
        flex-direction: column;
    }
    
    .phone-summary {
        order: 1 !important; /* Prima del form */
        padding: 0.75rem 1rem !important;
        border-radius: 8px;
        margin-bottom: 1rem;
        text-align: center;
        background: var(--primary-color) !important;
        color: white !important;
    }
    
    .phone-summary img {
        display: none !important; /* Nascondi immagine */
    }
    
    .phone-summary .memory-badge {
        display: none !important; /* Nascondi badge memoria */
    }
    
    .phone-summary .price-info {
        display: none !important; /* Nascondi box prezzo */
    }
    
    .phone-summary .price-large,
    .phone-summary .price-description {
        display: none !important; /* Nascondi prezzo */
    }
    
    .phone-summary h3 {
        font-size: 1rem !important;
        margin: 0 !important;
        font-weight: 600;
        color: white !important;
    }

    /* Content */
    main {
        padding: 1.25rem 0;
    }

    .phones-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .phone-card {
        border-radius: 10px;
    }

    .phone-image {
        height: 240px;
    }

    .phone-info {
        padding: 1rem;
    }

    .phone-name {
        font-size: 1rem;
    }

    .phone-price {
        font-size: 1.5rem;
    }

    .btn-select {
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    .form-container {
        padding: 1rem;
    }

    .form-group select {
        font-size: 0.875rem;
    }

    .radio-label {
        font-size: 0.875rem;
    }
}
