﻿/* =================================
   RESET & BASE STYLES
   ================================= */
*, *:before, *:after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =================================
   CSS VARIABLES - THEMES & FONTS
   ================================= */
/* Default Global Health Theme */
.theme-default,
.theme-globalhealth {
    --primary-color: #3baf29;
    --primary-font: Arial, Helvetica, sans-serif;
}

/* ReferralNet Theme */
.theme-referralnet {
    --primary-color: #f15f26;
    --primary-font: 'Raleway', Arial, sans-serif;
}

/* MasterCare Theme */
.theme-mastercare {
    --primary-color: #65C8D0;
    --primary-font: 'Raleway', Arial, sans-serif;
}

/* HotHealth Theme */
.theme-hothealth {
    --primary-color: #f37f20;
    --primary-font: 'Raleway', Arial, sans-serif;
}

/* Set default font for root element (fallback) */
:root {
    --primary-font: Arial, Helvetica, sans-serif;
}

body {
    font-family: var(--primary-font);
    background-color: #f8f9fa;
    color: rgb(51, 71, 91);
    line-height: 1.71;
}

/* =================================
   MAIN LAYOUT STRUCTURE
   ================================= */
.checkout-card {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    padding: 20px;
    gap: 10px;
}

.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
}
/* =================================
   HEADER / LOGO
   ================================= */

/* Brand logo section - logo left, pricing link right */
.brand-logo-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-top: 10px;
}

.brand-logo-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.pricing-link-right {
    display: flex;
    align-items: flex-start;
    margin-top: 8px;
}

/* Primary brand logo */
.brand-logo {
    max-width: 180px;
    height: auto;
}

.brand-logo-link {
    display: inline-block;
    text-decoration: none;
}

.brand-logo-link:hover .brand-logo {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.back-to-site-section {
    margin-top: 6px;
    text-align: left;
}

.back-to-site-link,
.back-to-pricing-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.back-to-site-link:hover,
.back-to-pricing-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Footer logo section - centered at bottom */
.footer-logo-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding-bottom: 20px;
}

.global-health-footer-logo {
    max-width: 180px;
    height: auto;
}

.footer-logo-link {
    display: inline-block;
    text-decoration: none;
}

.footer-logo-link:hover .global-health-footer-logo {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

/* =================================
   LEFT COLUMN - PRODUCT SUMMARY
   ================================= */
.summary-column {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0;
    height: fit-content;
}

.summary-section {
    background-color: var(--primary-color);
    color: white;
    padding: 16px 24px;
    border-radius: 8px 8px 0 0;
    margin: 0;
}

    .summary-section h5 {
        margin: 0;
        font-weight: 600;
        font-size: 1.125rem;
        letter-spacing: 0.025em;
    }

.summary-content {
    padding: 0;
}

/* Product Items */
.product-item {
    border-bottom: 1px solid #e9ecef;
    padding: 24px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

    .product-item:last-of-type {
        border-bottom: 1px solid #e9ecef;
    }

.product-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 24px;
}

    .product-title span:first-child {
        font-weight: 600;
        font-size: 0.875rem;
        line-height: 1.71;
        color: rgb(51, 71, 91);
        flex: 1;
    }

/* Product Pricing */
.product-price-container {
    text-align: right;
    line-height: 1.4;
    flex-shrink: 0;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    white-space: nowrap;
}

.price-line {
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
}

.product-price {
    box-sizing: border-box;
    font-size: 14px;
    font-style: unset;
    font-weight: 600;
    text-transform: unset;
    margin: 0px;
    padding: 0px;
    background-color: unset;
    color: rgb(51, 71, 91);
    letter-spacing: 0px;
    line-height: 24px;
}

.price-frequency {
    box-sizing: border-box;
    font-size: 14px;
    font-style: unset;
    font-weight: 300;
    text-transform: unset;
    margin: 0px;
    padding: 0px;
    background-color: unset;
    color: rgb(51, 71, 91);
    letter-spacing: 0px;
    line-height: 24px;
}

/* Product Description */
.product-description {
    line-height: 1.71;
    overflow-y: hidden;
    word-break: break-word;
    margin-top: 0;
    margin-bottom: 0;
    color: rgb(81, 111, 144);
    font-size: 12px;
}

    .product-description p {
        margin-bottom: 12px;
        line-height: 1.5;
    }

    .product-description ul {
        margin-left: 16px;
        list-style-type: disc;
        margin-top: 8px;
        margin-bottom: 0;
    }

    .product-description li {
        font-size: 0.875rem;
        color: rgb(51, 71, 91);
        margin-bottom: 4px;
        line-height: 1.71;
        font-weight: 300;
    }

/* Recipe Components */
.recipe-components {
    margin-top: 8px;
    padding-left: 4px;
}

.recipe-label {
    display: block;
    font-size: 0.8rem;
    color: #495057;
    font-weight: 600;
    margin-bottom: 2px;
}

.recipe-component-item {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 400;
    line-height: 1.5;
    padding-left: 8px;
}

.recipe-component-priced {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.recipe-component-priced .recipe-component-item {
    padding-left: 8px;
}

.component-price-container {
    text-align: right;
    flex-shrink: 0;
}

.component-price {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
}

/* Price Breakdown Section */
.price-breakdown {
    margin-top: 0;
    padding: 24px;
    border-top: none;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 1rem;
    line-height: 1.5;
}

    .price-row span:first-child {
        font-weight: 600;
        color: rgb(51, 71, 91);
        font-size: 0.875rem;
        line-height: 1.71;
    }

    .price-row span:last-child {
        font-weight: 600;
        color: #1a1a1a;
    }

.total-price {
    font-size: 1.125rem;
    font-weight: 600;
    border-top: 1px solid #e9ecef;
    padding-top: 12px;
    margin-top: 12px;
    margin-bottom: 8px;
    color: #1a1a1a;
}

    .total-price span:first-child {
        font-weight: 600;
        color: #1a1a1a;
        font-size: 1rem;
    }

    .total-price span:last-child {
        font-weight: 600;
        color: #1a1a1a;
        font-size: 1.125rem;
    }

/* Utility Classes */
.text-muted {
    color: #6b7280 !important;
    font-size: 0.875rem;
}

    .text-muted.small {
        box-sizing: border-box;
        font-size: 12px;
        font-style: unset;
        font-weight: 300;
        text-transform: unset;
        margin: 0px;
        padding: 0px;
        background-color: unset;
        color: rgb(81, 111, 144);
        letter-spacing: 0px;
        line-height: 18px;
    }

/* =================================
   RIGHT COLUMN - FORMS
   ================================= */
.form-column {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 24px;
    height: fit-content;
}

.form-section {
    margin-bottom: 14px;
}

    .form-section h6 {
        color: #1a1a1a;
        margin-bottom: 20px;
        font-weight: 600;
        font-size: 1.125rem;
        letter-spacing: 0.025em;
    }

/* Form Grid Layouts */
.contact-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

.contact-column {
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-control-wrapper {
    margin-bottom: 20px;
}

.form-control-half {
    flex: 1;
    display: block;
}

/* Form Labels */
.form-label {
    display: block;
    box-sizing: border-box;
    font-size: 14px;
    font-style: unset;
    font-weight: 600;
    text-transform: unset;
    margin: 0px 0px 8px 0px;
    padding: 0px;
    background-color: unset;
    color: rgb(51, 71, 91);
    letter-spacing: 0px;
    line-height: 18px;
}

.required-indicator {
    color: #333366;
    margin-left: 2px;
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    line-height: 20px;
    color: #33475b;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
    font-weight: 300;
}

    .form-input:focus {
        outline: none;
        border-color: #007bff;
        box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    }

    .form-input:invalid {
        border-color: #e74c3c;
    }

    .form-input::placeholder {
        color: #999;
        opacity: 1;
        font-weight: 300;
    }

/* Phone Input Specific */
.phone-input-container {
    display: flex;
    gap: 8px;
}

.country-select {
    width: 120px;
    padding: 8px 8px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

.phone-input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    line-height: 20px;
    color: #33475b;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
    font-weight: 300;
}

/* Billing Address Section */
.billing-address-header {
    color: #1a1a1a;
    margin-bottom: 20px;
    margin-top: 10px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.025em;
    font-weight: var(--trellis-typography-body-100-font-weight, 400);
    font-size: var(--trellis-typography-body-100-font-size, 14px);
    color: var(--trellis-color-text-core-default, #33475b);
    line-height: var(--trellis-typography-body-100-line-height, 20px);
}

/* Payment Elements */
#payment-element {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background-color: white;
    min-height: 44px;
}

    #payment-element .StripeElement {
        padding: 0;
    }

    #payment-element .p-Input {
        padding: 12px;
    }

/* Card Input Specific Styling */
#cardNumber {
    letter-spacing: 0.1em;
}

#expiryDate {
    text-align: center;
}

#cvv {
    text-align: center;
}

/* Submit Button */
.submit-button {
    width: 100%;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 10px;
}

    .submit-button:hover {
        background-color: var(--primary-color);
        filter: brightness(0.9);
    }

    .submit-button:active {
        background-color: var(--primary-color);
        filter: brightness(0.8);
    }

    .submit-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

/* Terms Section */
.terms-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.terms-text {
    font-size: 0.875rem;
    color: rgb(51, 71, 91);
    margin-bottom: 16px;
    line-height: 1.5;
}

    .terms-text a {
        color: var(--primary-color);
        text-decoration: none;
    }

        .terms-text a:hover {
            text-decoration: underline;
        }

/* Form Validation */
.input-validation-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.25) !important;
}

.validation-error {
    color: #e74c3c;
    font-size: 0.75rem;
    margin-top: 4px;
    display: block;
}

/* =================================
   THIRD PARTY COMPONENTS
   ================================= */
/* Stripe iFrame Adjustments */
.__PrivateStripeElement {
    height: 100%;
}

    .__PrivateStripeElement iframe {
        height: 100%;
    }

/* intl-tel-input Customization */
.iti {
    width: 100%;
}

.iti__flag-container {
    background-color: white;
    border: 1px solid #e9ecef;
    border-right: none;
    border-radius: 4px 0 0 4px;
}

.iti input[type="tel"] {
    padding-left: 85px !important;
    width: 100%;
    border-radius: 4px !important;
}

.iti--separate-dial-code .iti__selected-flag {
    background-color: transparent;
}

.iti__country-list {
    width: 300px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.iti input[type="tel"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Note: This needs explicit font-family as it's a third-party component that might override inheritance */
.iti__country {
    padding: 10px 10px;
    font-family: var(--primary-font);
}

    .iti__country:hover {
        background-color: #f8f9fa;
    }

    .iti__country.iti__highlight {
        background-color: #e8f5e9;
    }

/* =================================
   RESPONSIVE DESIGN
   ================================= */
@media (max-width: 768px) {
    /* Layout Adjustments */
    .checkout-card {
        padding: 16px;
        gap: 16px;
    }

    .checkout-container {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 16px;
    }

    /* Logo */
    .logo-row {
        text-align: center;
        margin-bottom: 16px;
        flex-direction: column;
        gap: 16px;
    }

    .global-health-logo {
        max-width: 150px;
    }

    /* Hide secondary logo on mobile */
    .secondary-logo {
        display: none !important;
    }

    /* Columns */
    .summary-column,
    .form-column {
        margin-top: 0;
    }

    .form-column {
        padding: 24px;
    }

    /* Product Display */
    .product-title {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .product-price-container {
        text-align: left;
        align-items: flex-start;
    }

    /* Form Layout */
    .contact-form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-control-half {
        margin-bottom: 16px;
    }

    .phone-input-container {
        flex-direction: column;
    }

    .country-select {
        width: 100%;
    }

    .iti__country-list {
        width: 100%;
        max-width: 290px;
    }
}
