/* ========================================================================
   Stripe Checkout Styles - Wizard Step 05 Design Match
   Fully responsive with enhanced UI/UX for mobile
   ========================================================================= */

/* Import wizard styles foundation */
@import url('_variables.css');
@import url('_animations.css');

/* Reset and Base Styles */
.aigf-stripe-checkout * {
    box-sizing: border-box;
}

.aigf-stripe-checkout {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-2);
    min-height: 100vh;
}

/* Modern Form Container - Matching Wizard */
.aigf-modern-form {
    background: var(--bg-2);
    overflow: hidden;
    width: 100%;
    padding: 40px 20px;
    min-height: 100vh;
}

.aigf-form-container-new {
    margin: 0 auto;
    width: 100%;
    max-width: 1400px;
    box-sizing: border-box;
}

.step-info h2 {
    color: var(--text-light1);
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.step-info p {
    color: var(--text-dim1);
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.9;
}

/* Main Checkout Container - Two Column Layout */
.aigf-checkout-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    margin-bottom: 40px;
    align-items: start;
}

/* Step Content - Main Form Area */
.aigf-step-content {
    background: var(--bg-1);
    border-radius: 16px;
    padding: 40px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(11, 7, 32, 0.3);
}

/* Field Groups - Matching Wizard Style */
.aigf-field-group-new {
    margin-bottom: 12px;
}

.aigf-field-label-new {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-light1);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.field-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.field-optional,
.field-note {
    font-size: 0.8rem;
    color: var(--text-muted1);
    font-weight: 400;
    opacity: 0.7;
}

.aigf-field-input-new,
.aigf-select2 {
    width: 100%;
    padding: 16px;
    background: var(--bg-1);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-light1);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.aigf-field-input-new:focus,
.aigf-select2:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-1);
    box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.15);
}

.aigf-field-input-new::placeholder {
    color: var(--text-muted1);
    opacity: 0.7;
}

/* Selection Grid */
.aigf-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* Account and Payment Sections */
.aigf-account-section,
.aigf-payment-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

.aigf-account-section h3,
.aigf-payment-section h3 {
    color: var(--text-light1);
    font-size: 1.3rem;
    margin: 0 0 24px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aigf-account-grid,
.aigf-billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
    row-gap: 0px;
}

/* Billing grid special layout */
.aigf-billing-grid .aigf-field-group-new:has(input[name="billing_name"]),
.aigf-billing-grid .aigf-field-group-new:has(input[name="billing_address"]) {
    grid-column: 1 / -1; /* Full width for name and address */
}

/* Address field specific styling */
.aigf-billing-grid .aigf-field-group-new:has(input[name="billing_address_2"]) {
    grid-column: 1 / -1; /* Full width for secondary address */
}

/* Country selector styling */
.aigf-billing-grid .aigf-field-group-new:has(select[name="billing_country"]) {
    grid-column: 1 / -1; /* Full width for country on mobile */
}

@media (min-width: 768px) {
    .aigf-billing-grid .aigf-field-group-new:has(select[name="billing_country"]) {
        grid-column: 2; /* Right column on desktop */
    }
}

/* Responsive billing grid adjustments */
@media (max-width: 768px) {
    .aigf-billing-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .aigf-billing-grid .aigf-field-group-new:has(input[name="billing_name"]),
    .aigf-billing-grid .aigf-field-group-new:has(input[name="billing_address"]) {
        grid-column: 1;
    }
}

/* Password Field */
.aigf-password-field {
    position: relative;
}

.aigf-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted1);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.aigf-password-toggle:hover {
    color: var(--text-light1);
    background: rgba(255, 255, 255, 0.1);
}

/* Stripe Elements */
.aigf-stripe-element {
    background: var(--bg-1);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: border-color 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
}

.aigf-stripe-element:focus-within,
.aigf-stripe-element--focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.15);
}

.aigf-card-errors {
    color: var(--error);
    font-size: 0.9rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
}

/* Field Hints and Status */
.aigf-field-hint {
    font-size: 0.85rem;
    color: var(--text-muted1);
    margin-top: 6px;
    opacity: 0.8;
}

.aigf-field-status {
    margin-top: 8px;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid;
}

.aigf-validation-success .aigf-success-message {
    color: var(--success);
    background: var(--success-bg);
    border-color: var(--success);
}

.aigf-validation-error .aigf-error-message {
    color: var(--error);
    background: var(--error-bg);
    border-color: var(--error);
}

/* Upgrade Notice */
.aigf-upgrade-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 12px;
    margin-bottom: 32px;
}

.upgrade-current,
.upgrade-new {
    text-align: center;
}

.current-label,
.new-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted1);
}

.current-plan-name {
    font-weight: 600;
    color: var(--text-light1);
    font-size: 14px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.upgrade-arrow {
    font-size: 20px;
    color: var(--success);
    font-weight: bold;
}

/* Order Summary Sidebar - Matching Wizard */
.aigf-order-summary {
    background: var(--bg-1);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(11, 7, 32, 0.3);
    position: sticky;
    top: 40px;
    height: fit-content;
}

.aigf-order-summary h3 {
    color: var(--text-light1);
    font-size: 1.4rem;
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--glass-border);
    font-weight: 600;
}

.aigf-summary-section {
    margin-bottom: 24px;
}

.aigf-summary-section h4 {
    color: var(--text-dim1);
    font-size: 1rem;
    margin: 0 0 16px 0;
    font-weight: 600;
}

.aigf-summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.aigf-summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.aigf-summary-label {
    color: var(--text-muted1);
    font-weight: 500;
    font-size: 0.9rem;
}

.aigf-summary-value {
    color: var(--text-light1);
    font-weight: 600;
    font-size: 0.9rem;
}

.aigf-discount-amount {
    color: var(--success) !important;
}

.aigf-summary-total {
    border-top: 2px solid var(--primary);
    padding-top: 16px;
    margin-top: 20px;
}

.aigf-total-price {
    font-size: 1.2rem;
    color: var(--primary) !important;
    font-weight: 700;
}

/* Action Buttons - Matching Wizard */
.aigf-summary-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aigf-btn-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.aigf-btn-primary-new {
    background: var(--gradient-primary);
    color: var(--text-light1);
    box-shadow: 0 4px 15px rgba(155, 93, 229, 0.3);
}

.aigf-btn-primary-new:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(155, 93, 229, 0.4);
}

.aigf-btn-secondary-new {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light1);
    border-color: var(--glass-border);
    backdrop-filter: blur(10px);
}

.aigf-btn-secondary-new:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 16px;
}

.aigf-btn-new:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Select2 Styling for Dropdowns */
.select2-container--default .select2-selection--single {
    background: var(--bg-1) !important;
    border: 2px solid var(--glass-border) !important;
    border-radius: 12px !important;
    height: 54px !important;
    padding: 8px 16px !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--open .select2-selection--single {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(155, 93, 229, 0.15) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-light1) !important;
    padding-left: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted1) !important;
    opacity: 0.7;
}

.select2-dropdown {
    background: var(--bg-1) !important;
    border: 2px solid var(--glass-border) !important;
    border-radius: 12px !important;
    backdrop-filter: blur(20px);
}

.select2-container--default .select2-results__option {
    background: var(--bg-1) !important;
    color: var(--text-light1) !important;
    padding: 12px 16px !important;
}

.select2-container--default .select2-results__option--highlighted {
    background: var(--primary) !important;
    color: var(--text-light1) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background: rgba(155, 93, 229, 0.2) !important;
}

/* Loading States */
.loading .aigf-btn-primary-new::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: var(--text-light1);
    border-radius: 50%;
    animation: button-loading-spinner 1s ease infinite;
}

@keyframes button-loading-spinner {
    from { transform: rotate(0turn); }
    to { transform: rotate(1turn); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .aigf-checkout-container {
        grid-template-columns: 1fr 350px;
        gap: 30px;
    }
}

@media (max-width: 1024px) {
    .aigf-checkout-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .aigf-order-summary {
        position: static;
        order: -1;
    }
    
    /* Hide the button in order summary on mobile */
    .aigf-summary-actions {
        display: none;
    }
    
    .step-info h2 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .aigf-modern-form {
        padding: 20px 16px;
    }
    
    .aigf-step-content,
    .aigf-order-summary {
        padding: 24px;
        border-radius: 12px;
    }
    
    .step-info h2 {
        font-size: 1.75rem;
    }
    
    .step-info p {
        font-size: 1rem;
    }
    
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .aigf-selection-grid,
    .aigf-account-grid,
    .aigf-billing-grid {
        grid-template-columns: 1fr;
        column-gap: 20px;
        row-gap: 0px;
    }
    
    .aigf-upgrade-notice {
        flex-direction: column;
        gap: 8px;
        padding: 16px;
    }
    
    .upgrade-arrow {
        transform: rotate(90deg);
        font-size: 16px;
    }
    
    .aigf-step-indicator {
        flex-direction: column;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .aigf-modern-form {
        padding: 16px 12px;
    }
    
    .aigf-step-content,
    .aigf-order-summary {
        padding: 20px;
    }
    
    .step-info h2 {
        font-size: 1.5rem;
    }
    
    .aigf-field-input-new,
    .aigf-select2 {
        padding: 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .aigf-btn-new {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
}

/* Mobile Checkout Button */
.aigf-mobile-checkout-btn {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
    display: none;
}

/* Show mobile button on mobile/tablet */
@media (max-width: 1024px) {
    .aigf-mobile-checkout-btn {
        display: block;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus Management */
.aigf-field-input-new:focus-visible,
.aigf-btn-new:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .aigf-field-input-new,
    .aigf-select2 {
        border-width: 3px;
    }
    
    .step-number {
        border: 2px solid var(--text-light1);
    }
}