/*
 * QCC Billing Forms CSS
 * 
 * Professional healthcare-focused billing form styling with 
 * responsive design, accessibility enhancements, and agency branding support.
 * 
 * @package qcctheme
 * @version 1.0.0
 */

/* ==========================================================================
   BILLING FORMS FOUNDATION
   ========================================================================== */

.qcc-billing-form-container {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 2rem auto;
    padding: 2rem;
    max-width: 100%;
}

.qcc-billing-form {
    position: relative;
}

.billing-form-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f8f9fa;
}

.billing-form-header .agency-logo img {
    max-height: 60px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.payment-header-content h4,
.payment-header-content h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   FORM SECTIONS
   ========================================================================== */

.form-section {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: #fafbfc;
    border-radius: 8px;
    border-left: 4px solid var(--agency-primary-color, #0066cc);
}

.form-section h6 {
    color: var(--agency-primary-color, #0066cc);
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.form-section h6 i {
    margin-right: 0.5rem;
}

/* ==========================================================================
   PAYMENT SUMMARY SECTIONS
   ========================================================================== */

.payment-summary,
.invoice-summary,
.appointment-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-left: 4px solid var(--agency-primary-color, #0066cc);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.payment-amount-summary {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.amount-breakdown {
    font-size: 0.95rem;
}

.amount-breakdown .fw-bold {
    color: var(--agency-secondary-color, #004499);
}

.amount-display .h4,
.amount-display .h5 {
    color: var(--agency-primary-color, #0066cc);
    font-weight: 700;
}

/* ==========================================================================
   PAYMENT METHOD OPTIONS
   ========================================================================== */

.payment-method-option,
.payment-type-option,
.category-option {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid #e9ecef !important;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.payment-method-option:hover,
.payment-type-option:hover,
.category-option:hover {
    background-color: #f8f9fa;
    border-color: var(--agency-primary-color, #0066cc) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.15);
}

.payment-method-option input[type="radio"]:checked + label,
.payment-type-option input[type="radio"]:checked + label,
.category-option input[type="radio"]:checked + label {
    color: var(--agency-primary-color, #0066cc);
    font-weight: 600;
}

.payment-method-option input[type="radio"]:checked,
.payment-type-option input[type="radio"]:checked,
.category-option input[type="radio"]:checked {
    background-color: var(--agency-primary-color, #0066cc);
    border-color: var(--agency-primary-color, #0066cc);
}

/* Radio button enhancement */
.form-check-input[type="radio"] {
    width: 1.2em;
    height: 1.2em;
    border-width: 2px;
}

.form-check-input[type="radio"]:checked {
    background-color: var(--agency-primary-color, #0066cc);
    border-color: var(--agency-primary-color, #0066cc);
}

/* ==========================================================================
   PLAN CARDS (for subscription forms)
   ========================================================================== */

.plan-card {
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    position: relative;
    height: 100%;
}

.plan-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: var(--agency-primary-color, #0066cc);
}

.plan-card.current-plan,
.plan-card.selected-plan {
    border-color: var(--agency-primary-color, #0066cc) !important;
    border-width: 3px !important;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.2);
}

.plan-badge {
    z-index: 10;
}

.plan-header {
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
}

.plan-header.bg-primary {
    background: linear-gradient(135deg, var(--agency-primary-color, #0066cc) 0%, var(--agency-secondary-color, #004499) 100%) !important;
}

.plan-name {
    font-weight: 700;
    font-size: 1.4rem;
}

.plan-price {
    margin: 1rem 0;
}

.plan-features {
    padding: 1.5rem;
    min-height: 200px;
}

.plan-features ul li {
    padding: 0.5rem 0;
    display: flex;
    align-items: flex-start;
}

.plan-features ul li i {
    margin-top: 0.2rem;
    margin-right: 0.75rem;
    color: #28a745;
    font-size: 0.9rem;
}

.plan-footer {
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #fafbfc;
}

/* ==========================================================================
   STRIPE ELEMENTS STYLING
   ========================================================================== */

.stripe-card-element-container {
    margin-bottom: 1.5rem;
}

.stripe-card-element {
    background: white;
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-height: 50px;
    position: relative;
}

.stripe-card-element:focus-within,
.stripe-card-element.StripeElement--focus {
    border-color: var(--agency-primary-color, #0066cc);
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
    outline: none;
}

.stripe-card-element.StripeElement--invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.stripe-card-element.StripeElement--complete {
    border-color: #28a745;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

.card-errors {
    min-height: 20px;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   FORM CONTROLS ENHANCEMENTS
   ========================================================================== */

.form-floating {
    position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-floating > .form-control:focus,
.form-floating > .form-select:focus {
    border-color: var(--agency-primary-color, #0066cc);
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

.form-floating > .form-control.is-valid,
.form-floating > .form-select.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
}

.form-floating > .form-control.is-invalid,
.form-floating > .form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-floating > label {
    color: #6c757d;
    font-weight: 500;
}

/* Enhanced checkboxes and switches */
.form-check-input:checked {
    background-color: var(--agency-primary-color, #0066cc);
    border-color: var(--agency-primary-color, #0066cc);
}

.form-check-input:focus {
    border-color: var(--agency-primary-color, #0066cc);
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

.form-switch .form-check-input:checked {
    background-color: var(--agency-primary-color, #0066cc);
    border-color: var(--agency-primary-color, #0066cc);
}

/* ==========================================================================
   COMPLIANCE AND SECURITY NOTICES
   ========================================================================== */

.compliance-notice,
.security-notice {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-left: 4px solid var(--agency-primary-color, #0066cc);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.compliance-notice h6,
.security-notice h6 {
    color: var(--agency-primary-color, #0066cc);
    font-weight: 600;
    margin-bottom: 1rem;
}

.compliance-notice ul,
.security-notice ul {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.compliance-notice ul li,
.security-notice ul li {
    padding: 0.25rem 0;
}

/* ==========================================================================
   SECURITY BADGES
   ========================================================================== */

.security-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 20px;
    margin: 0.25rem;
    transition: all 0.3s ease;
}

.security-badge:hover {
    background: #e9ecef;
    color: #495057;
    transform: translateY(-1px);
}

.security-badge i {
    margin-right: 0.5rem;
    color: var(--agency-primary-color, #0066cc);
}

/* ==========================================================================
   SUBMIT BUTTONS
   ========================================================================== */

.qcc-submit {
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 8px;
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.qcc-submit:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.qcc-submit:hover:before {
    left: 100%;
}

.qcc-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.qcc-submit:disabled {
    opacity: 0.7;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.qcc-submit .btn-loading {
    display: none;
}

.qcc-submit.processing .btn-text {
    display: none;
}

.qcc-submit.processing .btn-loading {
    display: inline-block;
}

/* ==========================================================================
   ALERTS AND MESSAGES
   ========================================================================== */

.alert {
    border-radius: 8px;
    border-width: 2px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
    border-color: #dc3545;
    color: #721c24;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border-color: #17a2b8;
    color: #0c5460;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-color: #ffc107;
    color: #856404;
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 0.3rem solid #f3f3f3;
    border-top: 0.3rem solid var(--agency-primary-color, #0066cc);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-border {
    color: var(--agency-primary-color, #0066cc) !important;
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 2px solid var(--agency-primary-color, #0066cc);
    border-radius: 12px 12px 0 0;
    padding: 1.5rem 2rem;
}

.modal-header .modal-title {
    color: var(--agency-primary-color, #0066cc);
    font-weight: 600;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 12px 12px;
    padding: 1.5rem 2rem;
}

/* ==========================================================================
   TABS (for payment method modals)
   ========================================================================== */

.nav-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 2rem;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent transparent var(--agency-primary-color, #0066cc) transparent;
    color: var(--agency-primary-color, #0066cc);
}

.nav-tabs .nav-link.active {
    color: var(--agency-primary-color, #0066cc);
    background: none;
    border-color: transparent transparent var(--agency-primary-color, #0066cc) transparent;
    font-weight: 600;
}

/* ==========================================================================
   CHARACTER COUNTERS
   ========================================================================== */

.character-count {
    font-size: 0.8rem;
    color: #6c757d;
    float: right;
    margin-top: 0.25rem;
}

.character-count.text-warning {
    color: #ffc107 !important;
}

.character-count.text-danger {
    color: #dc3545 !important;
}

/* ==========================================================================
   CATEGORY SELECTION (for general payment forms)
   ========================================================================== */

.category-content {
    text-align: center;
    padding: 1rem;
}

.category-icon {
    margin-bottom: 1rem;
}

.category-icon i {
    color: var(--agency-primary-color, #0066cc);
    transition: all 0.3s ease;
}

.category-option:hover .category-icon i {
    transform: scale(1.1);
    color: var(--agency-secondary-color, #004499);
}

.category-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.category-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .qcc-billing-form-container {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 8px;
    }
    
    .billing-form-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .billing-form-header .agency-logo img {
        max-height: 45px;
    }
    
    .form-section {
        margin-bottom: 2rem;
        padding: 1rem;
    }
    
    .payment-summary,
    .invoice-summary,
    .appointment-summary {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .plan-card {
        margin-bottom: 1.5rem;
    }
    
    .plan-header {
        padding: 1.5rem 1rem;
    }
    
    .plan-features {
        padding: 1rem;
        min-height: auto;
    }
    
    .security-info .d-flex {
        flex-direction: column;
        gap: 1rem !important;
    }
    
    .security-badge {
        justify-content: center;
        width: 100%;
        margin: 0.25rem 0;
    }
    
    .qcc-submit {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .stripe-card-element {
        padding: 12px 15px;
    }
}

@media (max-width: 576px) {
    .qcc-billing-form-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .form-section {
        padding: 0.75rem;
    }
    
    .payment-summary,
    .invoice-summary,
    .appointment-summary {
        padding: 0.75rem;
    }
    
    .compliance-notice,
    .security-notice {
        padding: 1rem;
    }
    
    .plan-header {
        padding: 1rem;
    }
    
    .category-content {
        padding: 0.75rem;
    }
    
    .category-icon i {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .qcc-billing-form-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .qcc-submit,
    .btn,
    button {
        display: none !important;
    }
    
    .security-info,
    .compliance-notice {
        display: none !important;
    }
    
    .payment-summary,
    .invoice-summary,
    .appointment-summary {
        border: 1px solid #ddd;
        background: white !important;
    }
}

/* ==========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */

/* Focus indicators */
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.25);
}

/* Screen reader text */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control,
    .form-select {
        border-width: 3px;
    }
    
    .payment-method-option,
    .payment-type-option,
    .category-option {
        border-width: 3px !important;
    }
    
    .stripe-card-element {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .qcc-submit:before {
        display: none;
    }
}

/* ==========================================================================
   DARK MODE SUPPORT (if agency uses dark themes)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .qcc-billing-form-container {
        background: #1a1d23;
        color: #e9ecef;
        box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    }
    
    .form-section {
        background: #2d3748;
        border-color: var(--agency-primary-color, #0066cc);
    }
    
    .payment-summary,
    .invoice-summary,
    .appointment-summary {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #4a5568;
        color: #e9ecef;
    }
    
    .form-control,
    .form-select {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #2d3748;
        border-color: var(--agency-primary-color, #0066cc);
        color: #e9ecef;
    }
    
    .stripe-card-element {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .modal-content {
        background-color: #1a1d23;
        color: #e9ecef;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #2d3748 0%, #1a1d23 100%);
    }
    
    .modal-footer {
        background: #2d3748;
        border-color: #4a5568;
    }
}

/* ==========================================================================
   CUSTOM PROPERTIES FOR AGENCY BRANDING
   ========================================================================== */

:root {
    --agency-primary-color: #0066cc;
    --agency-secondary-color: #004499;
    --agency-accent-color: #66b3ff;
    --agency-text-color: #333333;
    --agency-background-color: #ffffff;
    --agency-border-radius: 8px;
    --agency-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    --agency-transition: all 0.3s ease;
}

/* Agency-specific color classes */
.agency-primary {
    color: var(--agency-primary-color) !important;
}

.agency-bg-primary {
    background-color: var(--agency-primary-color) !important;
}

.agency-border-primary {
    border-color: var(--agency-primary-color) !important;
}

.agency-secondary {
    color: var(--agency-secondary-color) !important;
}

.agency-bg-secondary {
    background-color: var(--agency-secondary-color) !important;
}