/* checkout.css - Hostinger Inspired Checkout Design */

:root {
    --bg-checkout: #f8f9fa;
    --card-bg: #ffffff;
    --border-soft: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --accent-red: #d32f2f;
    /* Epinet Primary */
    --accent-dark: #111827;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

body.bg-light {
    background-color: var(--bg-checkout);
}

/* Page Title */
.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-family: 'Outfit', sans-serif;
}

/* Grid Layout */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media(min-width: 900px) {
    .checkout-grid {
        grid-template-columns: 1.8fr 1fr;
        gap: 2rem;
    }
}

/* Cards */
.hostinger-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hostinger-card:hover {
    border-color: var(--accent-red);
    box-shadow: 0 4px 8px rgba(211, 47, 47, 0.1);
}

/* Plan Header in Config */
.plan-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.plan-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.plan-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

/* Plus Banner Details */
.plus-banner {
    background-color: #f0f9ff;
    color: var(--text-primary, #111827);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.plus-banner-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.plus-banner-tag {
    display: inline-block;
    background: linear-gradient(90deg, #ea580c 0%, #eab308 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    width: fit-content;
    margin-bottom: 0.25rem;
}

.plus-title {
    font-size: 1rem;
    font-weight: 600;
}

.plus-desc {
    font-size: 0.85rem;
    color: #4b5563;
    margin: 0;
}

/* Toggle Switch (Adapted for dark bg inside banner) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked+.slider {
    background-color: var(--accent-red);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Quantity Rows */
.config-group {
    margin-bottom: 1.5rem;
}

.config-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.75rem;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border-soft);
}

.config-row:first-of-type {
    border-top: none;
}

.config-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.config-info .price-tag {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

/* Minimal Counter Controls */
.counter-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 40px;
}

.counter-btn {
    background: transparent;
    border: none;
    width: 36px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.counter-btn:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.counter-btn i {
    width: 14px;
    height: 14px;
}

.counter-value {
    width: 30px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}

/* Right Column: Summary Box */
@media (min-width: 900px) {
    .summary-col {
        align-self: stretch;
    }
    .summary-sticky {
        position: sticky;
        top: 6rem;
    }
}

.summary-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-item-name {
    flex: 1;
    padding-right: 1rem;
}

.summary-item-price {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.summary-divider {
    height: 1px;
    background: var(--border-soft);
    margin: 1.25rem 0;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.summary-total span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-total strong {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Discount Link */
.discount-toggle {
    color: #4f46e5;
    /* SaaS purple/blue to stand out, or could use Epinet blue */
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    margin-bottom: 1.5rem;
    transition: opacity 0.2s;
}

.discount-toggle:hover {
    opacity: 0.8;
}

.discount-input-wrapper {
    display: none;
    /* hidden by default */
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.discount-input-wrapper.open {
    display: flex;
}

.discount-input-wrapper input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
}

.discount-input-wrapper input:focus {
    border-color: var(--accent-red);
}

.discount-input-wrapper .btn-apply {
    background: var(--text-primary);
    color: white;
    border: none;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* Main CTA */
.btn-checkout-primary {
    display: block;
    width: 100%;
    background: var(--accent-red);
    color: #fff;
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
    margin-bottom: 1rem;
}

.btn-checkout-primary:hover {
    background: #b71c1c;
}

/* Trust Elements */
.trust-text {
    text-align: center;
    font-size: 0.75rem;
    color: #059669;
    /* Verde trust */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.4;
    white-space: nowrap;
}

.trust-text i {
    width: 18px;
    height: 18px;
    color: #059669;
    flex-shrink: 0;
}

/* --- RESPONSIVE MOBILE SUMMARY --- */
.mobile-summary-header {
    display: none;
}

.mobile-summary-toggle {
    display: none;
}

@media (max-width: 899px) {
    .desktop-only {
        display: none !important;
    }

    /* Il padding-bottom viene impostato dinamicamente via JS in base all'altezza
       effettiva del pannello riepilogo fisso in basso. */
    .checkout-container {
        padding-bottom: var(--mobile-summary-height, 200px) !important;
    }

    .mobile-bottom-spacer {
        display: none !important;
    }

    #billing-card {
        margin-bottom: 2rem !important;
    }

    .summary-col {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
    }

    .summary-sticky {
        margin: 0;
        border-radius: 24px 24px 0 0 !important;
        padding: 1.5rem !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15) !important;
        max-height: 85vh;
        overflow-y: auto;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        transition: padding 0.3s ease;
    }

    /* Before opening */
    .summary-details-collapsible {
        display: none;
    }

    .mobile-summary-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.25rem;
        cursor: pointer;
        padding-top: 0.5rem;
    }

    .mobile-total-text {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--text-primary);
    }

    /* When OPEN */
    .summary-sticky.is-open .summary-details-collapsible {
        display: block;
        animation: slideUpFade 0.3s ease forwards;
    }

    .summary-sticky.is-open .mobile-summary-toggle {
        display: none;
    }

    .summary-sticky.is-open .mobile-summary-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .mobile-summary-header h2 {
        font-size: 1.25rem;
        font-weight: 700;
        margin: 0;
        font-family: 'Outfit', sans-serif;
    }

    .btn-close-summary {
        background: transparent;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.25rem;
    }
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================
   ANIMATED BUTTON EFFECTS
   ============================ */

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 20px 10px rgba(211, 47, 47, 0);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
        transform: scale(1);
    }
}

.btn-animate-glow {
    animation: pulse-glow 2s infinite ease-in-out;
    position: relative;
    z-index: 1;
}

.btn-animate-glow::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: inherit;
    z-index: -1;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.btn-animate-glow:hover::after {
    opacity: 0.6;
}

.btn-animate-glow:hover {
    animation-play-state: paused;
    transform: translateY(-3px);
    background-color: #ef4444;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

/* ============================
   BILLING INVOICE FORM
   ============================ */

.billing-toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.billing-checkmark {
    position: relative;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s;
    top: 2px;
}

.billing-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.billing-toggle-label input[type="checkbox"]:checked ~ .billing-checkmark,
.billing-toggle-label:has(input:checked) .billing-checkmark {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.billing-toggle-label:has(input:checked) .billing-checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.billing-toggle-info {
    flex: 1;
}

.billing-toggle-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.billing-toggle-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.billing-type-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.billing-type-btn:has(input:checked) {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(211, 47, 47, 0.04);
}

.billing-type-btn input {
    accent-color: var(--accent-red);
    width: 16px;
    height: 16px;
}

.billing-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.billing-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.billing-input-group.b-full {
    grid-column: span 2;
}

.billing-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.billing-row .billing-input-group {
    flex: 1;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .billing-row {
        flex-direction: column;
        gap: 0;
    }
    .billing-row .billing-input-group {
        width: 100%;
    }
}

.billing-input-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.billing-input-group input {
    padding: 0.75rem 0.9rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text-primary);
    transition: border-color 0.2s;
    background: #fafafa;
}

.billing-input-group input:focus {
    outline: none;
    border-color: var(--accent-red);
    background: #fff;
}

@media (max-width: 600px) {
    .billing-fields-grid {
        grid-template-columns: 1fr;
    }
    .billing-input-group.b-full {
        grid-column: span 1;
    }
}