/**
 * Treatment Plan Quote Card Styles
 *
 * Comprehensive quote card for My Account Dashboard
 * Displays treatment options with pricing, skincare routine, and WhatsApp CTA
 *
 * @version 3.3.14
 * @since 2025-12-18
 * @since 2.0.1 - Added .woocommerce-MyAccount-card consistency (Issues v1)
 * @since 3.0.0 - Restyled to match sample-card design (icon-led sections, mint/teal palette)
 * @since 3.3.1 - Refined design: price inline with title, proper case titles, removed total row, dual buttons
 * @since 3.3.2 - Moved price badge to main card header (inline with plan title)
 * @since 3.3.3 - Restored pink badge, both badges inline with title, center-aligned
 * @since 3.3.4 - Fixed icon layout for option sections (added flexbox to .quote-option__section)
 * @since 3.3.5 - Mobile fix: keep icon and title inline (removed flex-direction: column)
 * @since 3.3.6 - Two-row header layout: pink badge on top, title left + price right on bottom
 * @since 3.3.7 - Full-width content: lists/tables span both columns using header-row pattern
 * @since 3.3.8 - Collapsible card: starts collapsed, pink gradient, smooth expand on click
 * @since 3.3.9 - Match woocommerce-MyAccount-card gradient and white text
 * @since 3.3.10 - Fix: Override inherited flex-direction to stack header/body vertically
 * @since 3.3.11 - Removed stat-card__subtitle, simplified title margin
 * @since 3.3.12 - Button styling: teal primary, outline secondary; removed body background
 * @since 3.3.13 - Mobile fix: removed negative margin/border-radius reset, fixed button selector
 * @since 3.3.14 - Fix: align-items: stretch on quote card, width: 100% on body for full width
 */

/* ============================================
   QUOTE CARD v3 DESIGN SYSTEM
   Based on sample-card design spec
   ============================================ */
:root {
    /* Sample Card Color Palette */
    --qc-primary-dark: #112233;
    --qc-text-muted: #556677;
    --qc-accent-mint: #e6f7f2;
    --qc-accent-teal: #1a8076;
    --qc-border-color: #e0e6ed;
    --qc-checkmark-bg: #f4f6f8;
    --qc-checkmark-color: #ccc;

    /* Section icon sizing */
    --qc-icon-size: 36px;
    --qc-icon-radius: 8px;
}

/* ============================================
   WOOCOMMERCE CARD CONSISTENCY (Issues v1)
   Ensure consistent border-radius/padding on treatment-plans page
   ============================================ */
.treatment-plan-dashboard .woocommerce-MyAccount-card {
    border-radius: 8px;
    padding: clamp(1.25rem, 2.5vw, 1.5rem);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   QUOTE CARD - Main Container
   ============================================ */
.quote-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: clamp(20px, 3vw, 30px);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Quote Card Header (v3.3.6 - Two row layout) */
.quote-card__header {
    padding: clamp(16px, 3vw, 24px);
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Bottom Row - Title left, Price right */
.quote-card__header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.quote-card__title {
    margin: 12px 0 0 0;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 700;
    color: #1d2327;
    flex: 1;
    min-width: 0;
}

/* Override WooCommerce h2 margin */
.woocommerce-account .woocommerce-MyAccount-content .quote-card__title {
    margin-top: 12px;
}

/* Price badge in header uses same styling as section price badge */
.quote-card__header .quote-price-badge {
    flex-shrink: 0;
}

/* ============================================
   QUOTE CARD - Sections (v3.0 Icon-Led Layout)
   ============================================ */
.quote-card__section {
    display: flex;
    gap: 16px;
    padding: clamp(16px, 3vw, 24px);
    border-bottom: 1px solid var(--qc-border-color);
}

.quote-card__section:last-child {
    border-bottom: none;
}

/* Section Icon Box (v3.0) */
.quote-section-icon {
    background: var(--qc-accent-mint);
    color: var(--qc-accent-teal);
    min-width: var(--qc-icon-size);
    height: var(--qc-icon-size);
    border-radius: var(--qc-icon-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* Section Content Wrapper (v3.0) */
.quote-section-content {
    flex: 1;
    min-width: 0; /* Prevent flex overflow */
}

.quote-section-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--qc-primary-dark);
}

/* Section Subtitle (v3.0) */
.quote-section-subtitle {
    font-size: 14px;
    color: var(--qc-text-muted);
    line-height: 1.4;
    margin: 0 0 16px 0;
}

/* Section Header - Title + Price Badge inline (v3.3.1) */
.quote-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.quote-subsection-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--qc-primary-dark);
    text-transform: capitalize;
    letter-spacing: 0;
}

/* Price Badge - Mint background (v3.3.1) */
.quote-price-badge {
    background: var(--qc-accent-mint);
    color: var(--qc-accent-teal);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   SKIN CONCERNS - What We Are Targeting (v3.0)
   ============================================ */
.quote-card__concerns {
    background: transparent; /* Removed gray background in v3.0 */
}

.quote-concerns-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quote-concern-item {
    font-size: 14px;
    color: var(--qc-primary-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.quote-concern-item:last-child {
    margin-bottom: 0;
}

/* Checkmark bullet style (v3.0) */
.quote-concern-item::before {
    content: '✓';
    color: var(--qc-checkmark-color);
    font-weight: bold;
    margin-right: 10px;
    background: var(--qc-checkmark-bg);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

/* Legacy arrow - hidden in v3.0 (CSS handles checkmarks) */
.quote-concern-arrow {
    display: none;
}

/* ============================================
   OPTION SELECTOR - Pill Tabs (Mobile Only)
   ============================================ */
.quote-card__option-selector {
    display: flex;
    gap: 8px;
    padding: 16px clamp(16px, 3vw, 24px);
    background: #f9f9f9;
    border-bottom: 1px solid #f0f0f0;
}

.quote-option-pill {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.quote-option-pill:hover {
    border-color: var(--qc-accent-teal);
    color: var(--qc-accent-teal);
}

.quote-option-pill:focus-visible {
    outline: 3px solid var(--qc-accent-teal);
    outline-offset: 2px;
}

.quote-option-pill--active,
.quote-option-pill[aria-selected="true"] {
    background: var(--qc-accent-teal);
    border-color: var(--qc-accent-teal);
    color: #fff;
}

/* Hide pill selector on desktop */
@media (min-width: 768px) {
    .quote-card__option-selector {
        display: none;
    }
}

/* ============================================
   OPTIONS CONTAINER
   ============================================ */
.quote-card__options {
    padding: clamp(16px, 3vw, 24px);
}

/* Desktop: Side-by-side layout for dual options */
@media (min-width: 768px) {
    .quote-card__options--dual {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .quote-card__options--dual .quote-option {
        display: block !important;
        background: #f9f9f9;
        border-radius: 8px;
        padding: clamp(16px, 2vw, 20px);
    }

    .quote-card__options--dual .quote-option[hidden] {
        display: block !important;
    }
}

/* ============================================
   QUOTE OPTION - Individual Option Panel
   ============================================ */
.quote-option {
    /* Hidden by default on mobile (controlled by JS) */
}

.quote-option[hidden] {
    display: none;
}

.quote-option--active {
    display: block;
}

.quote-option__label {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--qc-accent-teal);
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* Option Sections - Two-column layout: header row + full-width content (v3.3.7) */
.quote-option__section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.quote-option__section:last-of-type {
    margin-bottom: 24px;
}

/* Header row with icon and title */
.quote-section-header-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* Header text container */
.quote-section-header-text {
    flex: 1;
}

/* ============================================
   TREATMENTS LIST (v3.0)
   ============================================ */
.quote-treatments-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quote-treatment-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--qc-border-color);
    font-size: 14px;
    color: var(--qc-primary-dark);
}

.quote-treatment-item:last-child {
    border-bottom: none;
}

/* Checkmark bullet style (v3.0) */
.quote-treatment-item::before {
    content: '✓';
    color: var(--qc-checkmark-color);
    font-weight: bold;
    margin-right: 10px;
    background: var(--qc-checkmark-bg);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.quote-treatment-count {
    font-weight: 400;
    color: var(--qc-text-muted);
    font-size: 14px;
    min-width: auto;
    margin-left: auto;
}

.quote-treatment-x {
    color: var(--qc-text-muted);
    font-size: 12px;
    margin-right: 4px;
}

.quote-treatment-name {
    flex: 1;
}

/* ============================================
   FREQUENCY LIST (v3.0)
   ============================================ */
.quote-frequency-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quote-frequency-item {
    padding: 6px 0;
    font-size: 14px;
    color: var(--qc-primary-dark);
    display: flex;
    align-items: center;
}

/* Checkmark bullet style (v3.0) */
.quote-frequency-item::before {
    content: '✓';
    color: var(--qc-checkmark-color);
    font-weight: bold;
    margin-right: 10px;
    background: var(--qc-checkmark-bg);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

/* ============================================
   PRICING TABLE
   ============================================ */
.quote-pricing-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.quote-pricing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.quote-pricing-table th,
.quote-pricing-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.quote-pricing-table th {
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f9f9f9;
    white-space: nowrap;
}

.quote-pricing-table td {
    color: #3c434a;
}

.quote-pricing-table tbody tr:hover {
    background: #fafafa;
}

.quote-pricing-table tfoot td {
    border-top: 2px solid var(--qc-accent-teal);
    border-bottom: none;
    background: var(--qc-accent-mint);
}

.quote-savings-cell {
    color: #22c55e;
    font-weight: 600;
}

/* Mobile: Card-style pricing table */
@media (max-width: 600px) {
    .quote-pricing-table thead {
        display: none;
    }

    .quote-pricing-table tbody,
    .quote-pricing-table tfoot {
        display: block;
    }

    .quote-pricing-table tr {
        display: block;
        margin-bottom: 16px;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 12px;
    }

    .quote-pricing-table td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border-bottom: none;
    }

    .quote-pricing-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 12px;
        text-transform: uppercase;
    }

    .quote-pricing-table tfoot tr {
        background: #f0f9f7;
    }

    .quote-pricing-table tfoot td[colspan] {
        display: none;
    }
}

/* ============================================
   ACTION BUTTONS - Choose Plan + Ask Question (uses theme button styles)
   ============================================ */
.quote-option__cta {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

/* Primary button - Teal background, white text */
.quote-option__cta .wp-block-button__link {
    background: var(--qc-accent-teal);
    color: #fff;
    border: 2px solid var(--qc-accent-teal);
}

.quote-option__cta .wp-block-button__link:hover {
    background: #157069;
    border-color: #157069;
}

/* Secondary button - White background, teal text/border */
.quote-option__cta .wp-block-button__link.is-style-outline {
    background: #fff;
    color: var(--qc-accent-teal);
    border: 2px solid var(--qc-accent-teal);
}

.quote-option__cta .wp-block-button__link.is-style-outline:hover {
    background: var(--qc-accent-mint);
}

/* Mobile: Stack buttons vertically */
@media (max-width: 480px) {
    .quote-option__cta {
        flex-direction: column;
        gap: 10px;
    }

    .quote-option__cta .wp-block-button__link {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ============================================
   SKINCARE ROUTINE - Morning/Evening Grid
   ============================================ */
.quote-card__routine {
    background: #fefefe;
}

.quote-routine-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Desktop: Two-column layout */
@media (min-width: 768px) {
    .quote-routine-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

.quote-routine-column {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #f0f0f0;
}

.quote-routine-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.quote-routine-icon {
    font-size: 20px;
}

.quote-routine-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.quote-routine-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

.quote-routine-item:last-child {
    border-bottom: none;
}

.quote-routine-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.quote-routine-link {
    color: #3c434a;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.quote-routine-link:hover {
    color: var(--qc-accent-teal);
}

/* ============================================
   COLLAPSIBLE STAT CARD (v3.3.10 - Match MyAccount-card)
   ============================================ */
/* Quote Card Container - Same gradient as Level card */
.stat-card--quote {
    background: linear-gradient(90deg, #E390D9 0%, #F7A9B0 100%);
    border: none;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    margin-bottom: clamp(16px, 3vw, 24px);
    box-shadow: 0 2px 8px rgba(227, 144, 217, 0.3);
    /* v3.3.10: Override my-account-modern.css flex to stack header/body vertically */
    flex-direction: column;
    align-items: stretch; /* v3.3.14: Override flex-start to make children full width */
    padding: 0; /* Remove inherited padding, header/body have their own */
}

.stat-card--quote:hover {
    box-shadow: 0 4px 16px rgba(227, 144, 217, 0.4);
}

/* Card Header (Clickable) */
.stat-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    width: 100%; /* v3.3.10: Full width within flex column parent */
    box-sizing: border-box; /* Include padding in width calculation */
}

.stat-card__header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Icon - White background circle for contrast */
.stat-card__icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.25);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Area */
.stat-card__content {
    flex: 1;
    min-width: 0;
}

.stat-card__title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* Expand/Collapse Arrow - White */
.stat-card__arrow {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    padding: 10px;
    margin: -10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.stat-card__header[aria-expanded="true"] .stat-card__arrow {
    transform: rotate(90deg);
}

/* Card Body (Collapsible) */
.stat-card__body {
    display: none;
    padding: 0;
    border-top: 1px solid rgba(249, 168, 212, 0.4);
    width: 100%;
    box-sizing: border-box;
}

.stat-card__body.is-expanded {
    display: block;
    animation: slideDown 0.3s ease;
}

.stat-card__header[aria-expanded="true"] + .stat-card__body {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quote Content Sections */
.quote-goal,
.quote-services,
.quote-total {
    margin-bottom: 16px;
}

.quote-goal:last-child,
.quote-services:last-child,
.quote-total:last-child {
    margin-bottom: 0;
}

.quote-goal strong,
.quote-services strong,
.quote-total strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 6px;
}

.quote-goal p,
.quote-total p {
    margin: 0;
    font-size: 14px;
    color: #3c434a;
}

/* Services List */
.quote-services ul {
    margin: 0;
    padding-inline-start: 20px;
    list-style-type: disc;
}

.quote-services li {
    margin-bottom: 4px;
    font-size: 14px;
    color: #3c434a;
}

.quote-services li:last-child {
    margin-bottom: 0;
}

/* Total Price Emphasis */
.quote-total p {
    font-size: 16px;
    font-weight: 600;
    color: #d97706;
}

/* WhatsApp CTA (legacy) */
.quote-cta {
    background-color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    margin-block-start: 16px;
}

/* Focus State for Keyboard Accessibility */
.stat-card__header:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: -2px;
    border-radius: 12px 12px 0 0;
}

/* ============================================
   MOBILE OPTIMIZATION (v3.0)
   ============================================ */
@media (max-width: 600px) {
    /* Tighter spacing on smaller tablets */
    .quote-card__section {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    /* Keep icon and content inline on mobile (v3.3.5) */
    .quote-card__section {
        gap: 12px;
    }

    .quote-section-icon {
        min-width: 32px;
        height: 32px;
        font-size: 16px;
        flex-shrink: 0;
    }

    /* Option sections maintain column layout on mobile (v3.3.7) */
    .quote-option__section {
        gap: 12px;
    }

    .quote-section-header-row .quote-section-icon {
        min-width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .stat-card__header {
        padding: 14px 16px;
        gap: 10px;
    }

    .stat-card__icon {
        font-size: 24px;
    }

    .stat-card__title {
        font-size: 15px;
    }

    .quote-goal strong,
    .quote-services strong,
    .quote-total strong {
        font-size: 13px;
    }

    .quote-goal p,
    .quote-services li,
    .quote-total p {
        font-size: 13px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .stat-card--quote,
    .stat-card__header,
    .stat-card__arrow,
    .stat-card__body,
    .quote-cta a,
    .quote-card,
    .quote-option-pill,
    .quote-routine-link {
        transition: none;
        animation: none;
    }

    .stat-card__header[aria-expanded="true"] .stat-card__arrow {
        transform: rotate(90deg);
    }

    @keyframes slideDown {
        from, to {
            opacity: 1;
            transform: none;
        }
    }
}
