/**
 * Tretinoin World - Rx Badge & Checkout Consultation Frontend Styles
 */

/* ==========================================================================
   1. DESKTOP "RX REQUIRED" BADGE
   ========================================================================== */

/* Hidden by default on Mobile (< 768px) per strict prompt requirement */
.tw-rx-desktop-only {
    display: none !important;
}

/* Shown strictly on Desktop screens (>= 768px) */
@media (min-width: 768px) {
    .tw-rx-desktop-only {
        display: inline-flex !important;
    }
}

.tw-rx-badge {
    position: relative;
    z-index: 10;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.tw-rx-badge-inner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background-color: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
    box-shadow: 0 1px 2px rgba(159, 18, 57, 0.06);
    transition: all 0.2s ease;
}

.tw-rx-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Loop Badge Placement */
.tw-rx-badge-loop {
    margin-bottom: 6px;
    margin-top: 4px;
}

/* Product Card Absolute Overlay option if rendered inside thumbnail container */
.products .product .woocommerce-LoopProduct-link .tw-rx-badge-loop,
.elementor-product-loop-item .tw-rx-badge-loop {
    display: inline-block;
    margin: 4px 0 6px 0;
}

/* Single Product Page Badge */
.tw-rx-badge-single {
    margin-bottom: 12px;
    margin-top: 4px;
}

.tw-rx-badge-single .tw-rx-badge-inner {
    padding: 4px 10px;
    font-size: 11.5px;
    border-radius: 8px;
}

/* Inline Cart Badge */
.tw-rx-badge-cart,
.tw-rx-badge-inline {
    margin-left: 6px;
}

.tw-rx-badge-inline .tw-rx-badge-inner {
    padding: 2px 6px;
    font-size: 9.5px;
}

/* Theme variations */
.tw-theme-emerald .tw-rx-badge-inner {
    background-color: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.tw-theme-slate .tw-rx-badge-inner {
    background-color: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}


/* ==========================================================================
   2. CHECKOUT CONSULTATION FORM (Modeled after tretinoinworld.co.uk)
   ========================================================================== */

.tw-rx-consultation-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 30px;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1e293b;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.tw-rx-consultation-wrapper * {
    box-sizing: border-box;
}

/* Header */
.tw-rx-consultation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 1px solid #f1f5f9;
    gap: 16px;
}

.tw-rx-badge-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tw-rx-pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 6px;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.tw-rx-title {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.3 !important;
}

.tw-rx-subtitle {
    font-size: 12.5px;
    color: #64748b;
    margin: 0;
    line-height: 1.45;
    max-width: 620px;
}

.tw-rx-encrypted-tag {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    background: #f0fdf4;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}

/* Steps Navigation */
.tw-rx-steps-nav {
    display: flex;
    gap: 8px;
    margin: 18px 0 22px 0;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
    overflow-x: auto;
}

.tw-rx-step-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tw-rx-step-tab:hover {
    background: #f1f5f9;
    color: #334155;
}

.tw-rx-step-tab.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.tw-rx-step-tab.completed {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.tw-rx-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    font-size: 10.5px;
    font-weight: 800;
}

.tw-rx-step-tab.active .tw-rx-step-num {
    background: #ffffff;
    color: #0f172a;
}

.tw-rx-step-tab.completed .tw-rx-step-num {
    background: #059669;
    color: #ffffff;
}

/* Step Content Panels */
.tw-rx-step-content {
    display: none;
    animation: twRxFadeIn 0.25s ease;
}

.tw-rx-step-content.active {
    display: block;
}

@keyframes twRxFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.tw-rx-step-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tw-rx-step-icon {
    width: 32px;
    height: 32px;
    background: #059669;
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tw-rx-step-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.tw-rx-step-banner h4 {
    margin: 0 0 2px 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.tw-rx-step-banner p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.tw-rx-billing-link-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 12px;
    color: #166534;
    flex-wrap: wrap;
}

.tw-rx-billing-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tw-rx-billing-link-text {
    flex: 1;
    min-width: 200px;
}

.tw-rx-billing-link-text strong {
    color: #14532d;
    margin-right: 4px;
}

.tw-rx-scroll-billing-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 5px 12px;
    background: #ffffff;
    border: 1px solid #86efac;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: #15803d;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s ease;
}

.tw-rx-scroll-billing-btn:hover {
    background: #dcfce7;
    border-color: #4ade80;
    color: #14532d;
}

/* Form Grids */
.tw-rx-form-grid {
    display: grid;
    gap: 16px;
}

.tw-rx-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.tw-rx-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.tw-rx-col-span-2 {
    grid-column: span 2;
}

@media (max-width: 640px) {
    .tw-rx-grid-2,
    .tw-rx-grid-3 {
        grid-template-columns: 1fr;
    }
    .tw-rx-col-span-2 {
        grid-column: span 1;
    }
    .tw-rx-consultation-wrapper {
        padding: 16px;
    }
}

/* Form Inputs */
.tw-rx-field-group {
    display: flex;
    flex-direction: column;
}

.tw-rx-field-group label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #334155;
    margin-bottom: 6px;
    cursor: default;
}

.tw-rx-input,
.tw-rx-select,
.tw-rx-textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.4;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease-in-out;
    outline: none;
}

.tw-rx-input:focus,
.tw-rx-select:focus,
.tw-rx-textarea:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.tw-rx-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.tw-rx-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.tw-rx-subhint {
    font-size: 11.5px;
    color: #64748b;
    margin: 0 0 10px 0;
}

/* Alert Boxes */
.tw-rx-alert-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.45;
}

.tw-rx-alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.tw-rx-alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #d97706;
}

/* Checkbox Cards Grid (Allergies & Medications) */
.tw-rx-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.tw-rx-choice-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tw-rx-choice-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.tw-rx-choice-card.selected {
    background: #f0fdf4;
    border-color: #059669;
}

.tw-rx-choice-card input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #059669;
}

.tw-rx-choice-text {
    font-size: 12px;
    color: #1e293b;
    line-height: 1.35;
}

/* Affected Areas Pill Grid */
.tw-rx-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tw-rx-pill-card {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tw-rx-pill-card input[type="checkbox"] {
    display: none;
}

.tw-rx-pill-card:hover {
    border-color: #94a3b8;
}

.tw-rx-pill-card.selected {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

/* Step 4 Consent & Summary */
.tw-rx-summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.tw-rx-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #0f172a;
}

.tw-rx-status-ready {
    font-size: 11px;
    font-weight: 700;
    color: #059669;
}

.tw-rx-summary-body p {
    margin: 4px 0;
    font-size: 12px;
    color: #475569;
}

.tw-rx-consent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tw-rx-consent-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tw-rx-consent-item:hover {
    border-color: #cbd5e1;
}

.tw-rx-consent-item input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #059669;
    width: 16px;
    height: 16px;
}

.tw-rx-consent-text {
    font-size: 12px;
    line-height: 1.45;
    color: #334155;
}

.tw-rx-consent-text strong {
    display: block;
    color: #0f172a;
    margin-bottom: 2px;
}

/* Step Footer & Action Buttons */
.tw-rx-step-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.tw-rx-next-btn {
    background: #059669;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-left: auto;
}

.tw-rx-next-btn:hover {
    background: #047857;
}

.tw-rx-prev-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tw-rx-prev-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.tw-rx-completed-badge {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 700;
}

/* Thank you card */
.tw-thankyou-rx-card {
    background: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.06);
}

.tw-thankyou-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   3. MOBILE USER-FRIENDLINESS ENHANCEMENTS (<= 768px Viewports)
   ========================================================================== */

/* Progress Tracker for Mobile (Hidden on Desktop) */
.tw-rx-mobile-tracker {
    display: none;
}

@media (max-width: 768px) {
    /* Mobile Tracker */
    .tw-rx-mobile-tracker {
        display: block;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px 14px;
        margin: 12px 0 16px 0;
    }

    .tw-rx-mobile-step-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
    }

    .tw-rx-mobile-badge-step {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 3px 8px;
        background: #0f172a;
        color: #ffffff;
        border-radius: 6px;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.3px;
        flex-shrink: 0;
    }

    .tw-rx-mobile-step-title {
        font-size: 13px;
        font-weight: 700;
        color: #0f172a;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .tw-rx-mobile-prefilled-pill {
        font-size: 10.5px;
        font-weight: 700;
        color: #059669;
        background: #ecfdf5;
        border: 1px solid #a7f3d0;
        padding: 2px 7px;
        border-radius: 9999px;
        flex-shrink: 0;
    }

    .tw-rx-mobile-progress-track {
        width: 100%;
        height: 6px;
        background: #e2e8f0;
        border-radius: 9999px;
        overflow: hidden;
    }

    .tw-rx-mobile-progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #10b981 0%, #059669 100%);
        border-radius: 9999px;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Streamlined Container for Mobile Screens */
    .tw-rx-consultation-wrapper {
        padding: 16px 14px !important;
        margin-bottom: 20px !important;
        border-radius: 14px !important;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    }

    /* Stacked & Ergonomic Header */
    .tw-rx-consultation-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding-bottom: 14px !important;
    }

    .tw-rx-header-left {
        width: 100%;
    }

    .tw-rx-header-right {
        width: 100%;
    }

    .tw-rx-title {
        font-size: 16px !important;
        line-height: 1.3 !important;
        margin-bottom: 6px !important;
    }

    .tw-rx-subtitle {
        font-size: 12px !important;
        line-height: 1.45 !important;
    }

    .tw-rx-encrypted-tag {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        font-size: 11px;
        padding: 6px 10px;
        text-align: center;
    }

    /* Touch-Scrollable Horizontal Steps Bar */
    .tw-rx-steps-nav {
        margin: 10px 0 16px 0 !important;
        padding-bottom: 8px !important;
        gap: 6px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tw-rx-steps-nav::-webkit-scrollbar {
        display: none;
    }

    .tw-rx-step-tab {
        padding: 6px 12px !important;
        font-size: 11.5px !important;
        gap: 6px !important;
        border-radius: 9999px !important;
        min-height: 36px;
    }

    .tw-rx-step-num {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    /* Step Banner */
    .tw-rx-step-banner {
        padding: 10px 12px !important;
        margin-bottom: 14px !important;
        gap: 10px !important;
        border-radius: 10px !important;
    }

    .tw-rx-step-banner h4 {
        font-size: 13.5px !important;
        margin-bottom: 2px !important;
    }

    .tw-rx-step-banner p {
        font-size: 11.5px !important;
        line-height: 1.4 !important;
    }

    /* Single Column Inputs on Small Screens */
    .tw-rx-grid-2,
    .tw-rx-grid-3 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .tw-rx-col-span-2 {
        grid-column: span 1 !important;
    }

    /* Input Fields (16px font-size prevents iOS Safari auto-zoom!) */
    .tw-rx-input,
    .tw-rx-select,
    .tw-rx-textarea {
        font-size: 16px !important;
        padding: 11px 12px !important;
        min-height: 46px !important;
        border-radius: 10px !important;
    }

    .tw-rx-field-group label {
        font-size: 11.5px !important;
        margin-bottom: 5px !important;
    }

    /* Touch-Optimized Checkbox Cards */
    .tw-rx-checkbox-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .tw-rx-choice-card {
        padding: 12px 14px !important;
        min-height: 46px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        -webkit-tap-highlight-color: transparent;
    }

    .tw-rx-choice-card input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
        margin-top: 0 !important;
        flex-shrink: 0;
    }

    .tw-rx-choice-text {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    /* Touch-Friendly Area Pills */
    .tw-rx-pill-grid {
        gap: 6px !important;
    }

    .tw-rx-pill-card {
        padding: 8px 14px !important;
        font-size: 12.5px !important;
        min-height: 38px;
    }

    /* Mobile Step Action Footer */
    .tw-rx-step-footer {
        flex-direction: column-reverse !important;
        gap: 10px !important;
        margin-top: 20px !important;
        padding-top: 14px !important;
        width: 100% !important;
    }

    .tw-rx-next-btn {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: 0 !important;
        box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25) !important;
    }

    .tw-rx-prev-btn {
        width: 100% !important;
        min-height: 42px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Auto-link Notice Banner */
    .tw-rx-billing-link-card {
        padding: 10px 12px !important;
        gap: 8px !important;
        border-radius: 10px !important;
    }

    .tw-rx-scroll-billing-btn {
        width: 100% !important;
        justify-content: center !important;
        margin-top: 6px !important;
        padding: 7px 12px !important;
        font-size: 12px !important;
    }

    /* Step 4 Consent Items */
    .tw-rx-consent-item {
        padding: 12px 14px !important;
        border-radius: 10px !important;
        gap: 10px !important;
    }

    .tw-rx-consent-item input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
        margin-top: 2px !important;
        flex-shrink: 0;
    }

    .tw-rx-consent-text {
        font-size: 12.5px !important;
        line-height: 1.4 !important;
    }

    .tw-rx-summary-card {
        padding: 12px 14px !important;
        border-radius: 10px !important;
    }
}
