/**
 * Billing Pages CSS - Pixel Perfect Styling
 * For pages 1.5.1 and 1.5.2
 * 
 * Design Reference: 1.5.1 & 1.5.2 Pago Factura _ Desktop.png
 * @version 2.0.0
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --billing-blue: #214780;
    --billing-cyan: #0092BC;
    --billing-cyan-light: rgba(0, 146, 188, 0.1);
    --billing-green: #10B981;
    --billing-gray: #6B7280;
    --billing-gray-light: #9CA3AF;
    --billing-light-gray: #F3F4F6;
    --billing-border: #E5E7EB;
    --billing-white: #FFFFFF;
    --billing-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --billing-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --billing-radius: 16px;
    --billing-radius-sm: 8px;
}

/* ============================================
   Info Banner
   ============================================ */
.billing-info-banner {
    background: linear-gradient(90deg, var(--billing-cyan) 0%, #007a9e 100%);
    color: var(--billing-white);
    text-align: center;
    padding: 12px 24px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.billing-info-banner strong {
    font-weight: 700;
}

/* ============================================
   Main Section
   ============================================ */
.billing-main-section {
    padding: 32px 0 80px;
    background: var(--billing-white);
    min-height: calc(100vh - 200px);
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   Billing Header
   ============================================ */
.billing-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.billing-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--billing-blue);
    transition: color 0.2s ease;
}

.billing-back-link:hover {
    color: var(--billing-cyan);
}

.billing-page-title {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--billing-blue);
    margin: 0;
}

/* ============================================
   Billing Tabs (1.5.1 & 1.5.2)
   ============================================ */
.billing-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
}

.billing-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: 2px solid var(--billing-border);
    background: var(--billing-white);
    color: var(--billing-gray);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.billing-tab:first-child {
    border-radius: 50px 0 0 50px;
    border-right: none;
}

.billing-tab:last-child {
    border-radius: 0 50px 50px 0;
    border-left: none;
}

.billing-tab.active {
    background: var(--billing-cyan);
    border-color: var(--billing-cyan);
    color: var(--billing-white);
}

.billing-tab:not(.active):hover {
    border-color: var(--billing-cyan);
    color: var(--billing-cyan);
}

.billing-tab svg {
    flex-shrink: 0;
}

/* ============================================
   Content Wrapper (1.5.1)
   ============================================ */
.billing-content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.billing-mascot {
    flex-shrink: 0;
    margin-top: 40px;
}

/* ============================================
   Form Card
   ============================================ */
.billing-form-card {
    flex: 1;
    background: var(--billing-white);
    padding: 40px;
    border-radius: var(--billing-radius);
    box-shadow: var(--billing-shadow-lg);
}

.billing-tab-panel {
    display: none;
}

.billing-tab-panel.active {
    display: block;
}

.billing-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   Form Groups
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-city {
    min-width: 200px;
}

.form-group-input {
    flex: 1;
}

.form-group-small {
    max-width: 180px;
}

.form-label {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--billing-gray);
}

.form-label-inline {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--billing-gray);
    margin-bottom: 4px;
}

.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;
}

/* ============================================
   Form Inputs
   ============================================ */
.form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: 16px 20px;
    padding-right: 40px;
    border: 2px solid var(--billing-border);
    border-radius: var(--billing-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: var(--billing-blue);
    background: var(--billing-white);
    transition: border-color 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--billing-cyan);
}

.form-input.error {
    border-color: #EF4444;
}

.form-input::placeholder {
    color: var(--billing-gray-light);
}

.input-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px;
    border: none;
    background: transparent;
    color: var(--billing-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.input-clear-btn:hover {
    opacity: 1;
}

/* ============================================
   Select Inputs
   ============================================ */
.form-select-wrapper {
    position: relative;
}

.form-select {
    width: 100%;
    padding: 16px 44px 16px 20px;
    border: 2px solid var(--billing-border);
    border-radius: var(--billing-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: var(--billing-blue);
    background: var(--billing-white);
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
    outline: none;
}

.form-select:focus {
    border-color: var(--billing-cyan);
}

.form-select option[value=""] {
    color: var(--billing-gray-light);
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--billing-gray);
}

/* ============================================
   Error Messages
   ============================================ */
.error-message {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #EF4444;
    display: none;
    min-height: 16px;
}

.form-group.has-error .error-message {
    display: block;
}

/* ============================================
   Consultar Button
   ============================================ */
.btn-billing-consultar {
    width: 100%;
    padding: 18px 32px;
    background: var(--billing-blue);
    color: var(--billing-white);
    border: none;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.btn-billing-consultar:hover {
    background: #1a3a66;
    transform: translateY(-2px);
}

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

.btn-billing-consultar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Payment Grid (1.5.2)
   ============================================ */
.billing-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

/* ============================================
   Invoice Card (1.5.2)
   ============================================ */
.billing-invoice-card {
    background: var(--billing-white);
    border-radius: var(--billing-radius);
    box-shadow: var(--billing-shadow);
    padding: 24px;
}

.invoice-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.invoice-icon {
    flex-shrink: 0;
    width: 48px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.invoice-header-text {
    flex: 1;
}

.invoice-plan-name {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--billing-cyan);
    margin: 0 0 4px;
}

.invoice-month {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--billing-blue);
    margin: 0 0 2px;
}

.invoice-customer {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--billing-blue);
    margin: 0;
}

.invoice-divider {
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--billing-cyan) 0,
        var(--billing-cyan) 8px,
        transparent 8px,
        transparent 16px
    );
    margin: 16px 0;
}

.invoice-services {
    margin-bottom: 24px;
}

.services-title {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--billing-cyan);
    margin: 0 0 16px;
}

.service-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.service-name {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--billing-blue);
}

.service-price {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--billing-blue);
}

.service-detail {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--billing-gray);
    margin-left: 16px;
    margin-bottom: 8px;
}

.invoice-total-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--billing-border);
}

.total-mascot {
    flex-shrink: 0;
}

.total-label {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--billing-cyan);
}

.total-amount {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--billing-cyan);
    margin-left: auto;
}

/* ============================================
   Promotions / Adicionales (1.5.2) - Frame 64 Layout
   ============================================ */
.billing-promotions {
    padding: 0;
}

.promotions-title {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--billing-blue);
    margin: 0 0 16px;
}

/* Adicionales Cards Container - Horizontal Flex */
.adicionales-cards {
    display: flex;
    gap: 24px;
    justify-content: flex-start;
}

/* Individual Adicional Card - Frame 64 Design Spec */
.adicional-card {
    flex: 0 0 262px;
    width: 262px;
    height: 287px;
    position: relative;
    border-radius: 26px;
    overflow: hidden;
    background: var(--billing-white);
    box-shadow: var(--billing-shadow);
    display: flex;
    flex-direction: column;
}

/* Card Image Container */
.adicional-card .card-image {
    position: relative;
    width: 100%;
    height: 230px;
    overflow: hidden;
    flex-shrink: 0;
}

.adicional-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Card Overlay with Text */
.adicional-card .card-overlay {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

.adicional-card .promo-price-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--billing-white);
    background: rgba(33, 71, 128, 0.9);
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.adicional-card .promo-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--billing-white);
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.adicional-card .btn-solicitar {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    background: var(--billing-cyan);
    color: var(--billing-white);
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.adicional-card .btn-solicitar:hover {
    background: #007a9e;
}

/* Agregar Ahora Button */
.btn-agregar-ahora {
    width: 100%;
    padding: 14px 24px;
    background: var(--billing-white);
    border: none;
    border-top: 1px solid var(--billing-border);
    color: var(--billing-cyan);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-agregar-ahora:hover {
    background: var(--billing-cyan-light);
    color: var(--billing-blue);
}

/* Legacy promo-card styles (keep for backward compatibility) */
.promotions-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.promo-card {
    position: relative;
    border-radius: var(--billing-radius-sm);
    overflow: hidden;
    box-shadow: var(--billing-shadow);
}

.promo-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.promo-overlay {
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
}

.promo-price {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--billing-white);
}

.btn-promo-add {
    position: absolute;
    bottom: 8px;
    left: 16px;
    padding: 8px 16px;
    background: transparent;
    border: 2px solid var(--billing-cyan);
    border-radius: 4px;
    color: var(--billing-cyan);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-promo-add:hover {
    background: var(--billing-cyan);
    color: var(--billing-white);
}

/* ============================================
   Payment Method Section (1.5.2)
   ============================================ */
.billing-payment-method {
    background: var(--billing-white);
    border-radius: var(--billing-radius);
    box-shadow: var(--billing-shadow);
    padding: 32px;
}

.payment-method-title {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--billing-blue);
    margin: 0 0 24px;
}

/* ============================================
   Payment Tabs
   ============================================ */
.payment-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
}

.payment-tab {
    padding: 12px 32px;
    border: 2px solid var(--billing-border);
    background: var(--billing-white);
    color: var(--billing-gray);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-tab:first-child {
    border-radius: 50px 0 0 50px;
    border-right: none;
}

.payment-tab:nth-child(2) {
    border-left: none;
    border-right: none;
}

.payment-tab:last-child {
    border-radius: 0 50px 50px 0;
    border-left: none;
}

.payment-tab.active {
    background: var(--billing-blue);
    border-color: var(--billing-blue);
    color: var(--billing-white);
}

.payment-tab:not(.active):hover {
    border-color: var(--billing-blue);
    color: var(--billing-blue);
}

/* ============================================
   Payment Panel
   ============================================ */
.payment-panel {
    display: none;
}

.payment-panel.active {
    display: block;
}

.payment-form {
    max-width: 800px;
    margin: 0 auto;
}

.payment-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.payment-form-grid .form-group-small {
    grid-column: span 1;
}

/* ============================================
   Pagar Button
   ============================================ */
.btn-billing-pagar {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 18px 32px;
    background: var(--billing-blue);
    color: var(--billing-white);
    border: none;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.btn-billing-pagar:hover {
    background: #1a3a66;
    transform: translateY(-2px);
}

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

.btn-billing-pagar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Loading State
   ============================================ */
.btn-billing-consultar.loading,
.btn-billing-pagar.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-billing-consultar.loading::after,
.btn-billing-pagar.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: billingSpinner 0.8s linear infinite;
}

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

/* ============================================
   Floating Contact Button
   ============================================ */
.floating-contact {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.floating-contact-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--billing-cyan);
    color: var(--billing-white);
    border: none;
    border-radius: 8px 0 0 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transition: background 0.3s ease;
}

.floating-contact-btn:hover {
    background: #007a9e;
}

.floating-contact-btn svg {
    transform: rotate(90deg);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .billing-payment-grid {
        grid-template-columns: 1fr;
    }
    
    .billing-promotions {
        order: 2;
    }
    
    .promotions-grid {
        flex-direction: row;
    }
    
    .promo-card {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .billing-page-title {
        font-size: 24px;
    }
    
    .billing-tabs {
        flex-direction: column;
        align-items: stretch;
        max-width: 300px;
        margin: 0 auto 32px;
    }
    
    .billing-tab:first-child {
        border-radius: 50px 50px 0 0;
        border-right: 2px solid var(--billing-border);
        border-bottom: none;
    }
    
    .billing-tab:last-child {
        border-radius: 0 0 50px 50px;
        border-left: 2px solid var(--billing-border);
        border-top: none;
    }
    
    .billing-tab.active:first-child {
        border-right-color: var(--billing-cyan);
    }
    
    .billing-tab.active:last-child {
        border-left-color: var(--billing-cyan);
    }
    
    .billing-content-wrapper {
        flex-direction: column;
    }
    
    .billing-mascot {
        display: none;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .payment-tabs {
        flex-direction: column;
        max-width: 200px;
        margin: 0 auto 24px;
    }
    
    .payment-tab:first-child {
        border-radius: 50px 50px 0 0;
        border-right: 2px solid var(--billing-border);
        border-bottom: none;
    }
    
    .payment-tab:nth-child(2) {
        border-left: 2px solid var(--billing-border);
        border-right: 2px solid var(--billing-border);
    }
    
    .payment-tab:last-child {
        border-radius: 0 0 50px 50px;
        border-left: 2px solid var(--billing-border);
        border-top: none;
    }
    
    .payment-form-grid {
        grid-template-columns: 1fr;
    }
    
    .promotions-grid {
        flex-direction: column;
    }
    
    /* Adicionales cards responsive */
    .adicionales-cards {
        flex-direction: column;
    }
    
    .adicional-card .card-image {
        height: 160px;
    }
}

@media (max-width: 480px) {
    .billing-main-section {
        padding: 24px 0 60px;
    }
    
    .billing-form-card {
        padding: 24px;
    }
    
    .billing-payment-method {
        padding: 24px;
    }
    
    .total-amount {
        font-size: 24px;
    }
    
    .floating-contact-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}
