/* Interactive Anamnese Portal Styles */
.tv-anamnese-portal-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* --- Mode 1: Welcome Screen --- */
.tv-portal-welcome-screen {
    text-align: center;
    background: #ffffff;
    border-radius: 12px;
    padding: 60px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
}

.tv-portal-title {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.tv-portal-subtitle {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 40px;
}

.tv-portal-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tv-portal-btn {
    padding: 16px 32px;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.tv-portal-btn.primary-btn {
    background-color: #936179;
    color: #ffffff;
    border: 1px solid #936179;
}

.tv-portal-btn.primary-btn:hover {
    background-color: #794d62;
    border-color: #794d62;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(147, 97, 121, 0.2);
}

.tv-portal-btn.secondary-btn {
    background-color: #ffffff;
    color: #4b5563;
    border: 1px solid #cbd5e1;
}

.tv-portal-btn.secondary-btn:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.tv-portal-btn i {
    font-size: 18px;
}

/* --- QR Code Container --- */
.tv-qr-container {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tv-qr-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1) !important;
}

/* --- QR Scanner Modal --- */
.tv-scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.tv-scanner-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    max-width: 460px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
}

.tv-scanner-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    color: #64748b;
    cursor: pointer;
    font-weight: 300;
}

.tv-scanner-close:hover {
    color: #ef4444;
}

.tv-scanner-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #1e293b;
}

/* --- Mode 2: Interactive Form Container --- */
.tv-anamnese-form-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
}

.tv-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.tv-brand-selector {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 100px;
    padding: 4px;
    border: 1px solid #e2e8f0;
}

.tv-brand-tab {
    padding: 10px 20px;
    border-radius: 100px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tv-brand-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tv-back-to-portal-btn {
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.15s ease;
}

.tv-back-to-portal-btn:hover {
    color: #936179;
}

/* Logo Headers */
.tv-brand-header-logo {
    text-align: center;
    margin-bottom: 40px;
    padding: 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#tv-selection-group-header {
    margin-bottom: 20px;
}

/* Dynamic booking group logo in the header */
.tv-group-header-logo {
    max-height: 180px;
    width: auto;
    max-width: 500px;
    object-fit: contain;
    display: block;
}

/* Booking Group Selection Screen */
.tv-booking-group-selection-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.tv-booking-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.tv-booking-group-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 220px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.tv-booking-group-card:hover {
    border-color: #936179;
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(147, 97, 121, 0.1), 0 10px 10px -5px rgba(147, 97, 121, 0.04);
}

.tv-booking-group-card .tv-card-logo-wrap {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 5px;
}

.tv-booking-group-card .tv-card-logo {
    max-height: 120px;
    max-width: 240px;
    object-fit: contain;
    pointer-events: none;
}

.tv-booking-group-card .tv-card-placeholder-icon {
    font-size: 54px;
    color: #cbd5e1;
}

.tv-booking-group-card .tv-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 20px 0;
    text-align: center;
}

.tv-booking-group-card .tv-card-select-btn {
    background-color: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
}

.tv-booking-group-card:hover .tv-card-select-btn {
    background-color: #936179;
    color: #ffffff;
}



.tv-group-header-name {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.tv-brand-header-logo.aesthetic-logo-active {
    background-color: #faf7f8;
}

.tv-brand-header-logo.newhair-logo-active {
    background-color: #f3f7fa;
}

/* Aesthetic Logo text styling */
.tv-brand-logo-aesthetic {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tv-brand-logo-aesthetic .tv-logo-main {
    font-size: 36px;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: #936179;
    text-transform: lowercase;
}

.tv-brand-logo-aesthetic .tv-logo-sub {
    font-size: 12px;
    letter-spacing: 0.25em;
    color: #64748b;
    text-transform: lowercase;
    margin-top: -4px;
}

/* New Hair Logo text styling */
.tv-brand-logo-newhair .tv-logo-newhair-text {
    font-size: 32px;
    font-weight: 800;
    color: #3b82f6;
    letter-spacing: -0.03em;
}

.tv-brand-logo-newhair .tv-logo-newhair-text .thin {
    font-weight: 300;
}

.tv-brand-logo-newhair .tv-logo-newhair-text .clinic {
    display: inline-block;
    background-color: #3b82f6;
    color: #ffffff;
    padding: 2px 8px;
    font-size: 20px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
}

/* --- Form Fields & Grid --- */
.tv-form-section {
    margin-bottom: 40px;
}

.tv-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 25px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-section-title i {
    color: #936179;
}

.tv-brand-tab[data-brand="newhair"].active~.tv-brand-header-logo .tv-section-title i {
    color: #3b82f6;
}

.tv-grid-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.tv-grid-row.cols-2>* {
    flex: 1;
}

.tv-grid-row.cols-3>* {
    flex: 1;
}

.tv-grid-row.cols-3-1>*:first-child {
    flex: 3;
}

.tv-grid-row.cols-3-1>*:last-child {
    flex: 1;
}

@media (max-width: 768px) {
    .tv-grid-row {
        flex-direction: column;
        gap: 15px;
    }
}

.tv-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tv-field-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

/* Input Styles */
.tv-custom-input,
.tv-custom-select,
.tv-custom-textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.tv-custom-input:focus,
.tv-custom-select:focus,
.tv-custom-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.tv-custom-input[readonly] {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
}

/* Custom Radio & Checkbox Buttons styled for tablets */
.tv-radio-buttons-group {
    display: flex;
    gap: 10px;
}

.tv-radio-label {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.tv-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tv-custom-radio {
    display: block;
    text-align: center;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s ease;
}

.tv-radio-label input[type="radio"]:checked+.tv-custom-radio {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.18);
}

.tv-time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-time-input-group .short-num {
    width: 80px;
    text-align: center;
}

/* Checkbox design system */
.tv-checkbox-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tv-checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px 24px;
}

@media (min-width: 768px) {
    .tv-checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .tv-checkbox-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tv-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #334155;
    user-select: none;
}

.tv-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #3b82f6;
}

.tv-inline-input {
    border: none;
    border-bottom: 1px solid #cbd5e1;
    outline: none;
    padding: 4px 8px;
    font-size: 14px;
    color: #1e293b;
    width: 200px;
    transition: border-color 0.15s ease;
}

.tv-inline-input:focus {
    border-bottom-color: #3b82f6;
}



.tv-brand-tab[data-brand="newhair"].active~form {
    --color-primary: #3b82f6;
}

/* --- TV_Toggle_Filter Overrides for Beratungswunsch grid design --- */
.tv-custom-toggle-grid.tv-toggle-wrap {
    display: block !important;
    width: 100% !important;
}

.tv-custom-toggle-grid .tv-toggle-buttons-wrapper {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px 24px !important;
    width: 100% !important;
}

@media (min-width: 768px) {
    .tv-custom-toggle-grid .tv-toggle-buttons-wrapper {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 1024px) {
    .tv-custom-toggle-grid .tv-toggle-buttons-wrapper {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

.tv-custom-toggle-grid .tv-toggle-box {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 0 !important;
    background: transparent !important;
    min-height: auto !important;
    cursor: pointer !important;
}

.tv-custom-toggle-grid .tv-toggle-box-name {
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #334155 !important;
}

.tv-custom-toggle-grid .tv-toggle-checkbox {
    width: 20px !important;
    height: 20px !important;
    border-radius: 4px !important;
    border: 2px solid #cbd5e1 !important;
}

/* --- TV_Radio_Button_Filter Overrides for Salutation / Gender design --- */
.tv-custom-radio-group.tv-radio-wrap {
    display: block !important;
}

.tv-custom-radio-group .tv-radio-buttons-wrapper {
    display: flex !important;
    gap: 10px !important;
    width: 100% !important;
}

.tv-custom-radio-group .tv-radio-box {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 48px !important;
    background: #ffffff !important;
    border: 1px solid var(--color-border, #cbd5e1) !important;
    border-radius: var(--border-radius-md, 8px) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--color-text, #475569) !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

.tv-custom-radio-group .tv-radio-checkbox {
    display: none !important;
    /* Hide checkmarks for gender buttons */
}

.tv-custom-radio-group .tv-radio-box-name {
    color: inherit !important;
    font-size: 15px !important;
    font-weight: 600 !important;
}

.tv-custom-radio-group .tv-radio-box-active {
    background-color: var(--color-primary, #936179) !important;
    border-color: var(--color-primary, #936179) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(147, 97, 121, 0.15) !important;
}

.tv-custom-radio-group .tv-radio-box:hover {
    background-color: var(--color-bg-hover) !important;
    border-color: var(--color-border-hover, #94a3b8) !important;
    color: #475569 !important;
}

.tv-custom-radio-group .tv-radio-box-active:hover {
    background-color: var(--color-primary, #936179) !important;
    border-color: var(--color-primary, #936179) !important;
    color: #ffffff !important;
}

/* Brand overrides for active radio box shadows */
.tv-brand-tab[data-brand="newhair"].active~form .tv-custom-radio-group .tv-radio-box-active {
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.18) !important;
}



/* Consultation Grid */
.tv-consultation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    background-color: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}

.tv-consult-category {
    background: #ffffff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}

.tv-consult-category h4 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #936179;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}

.tv-consult-category .tv-checkbox-label {
    font-size: 13px;
    margin-bottom: 8px;
}

.tv-consult-category .tv-checkbox-label:last-child {
    margin-bottom: 0;
}

/* Submit Actions */
.tv-form-actions {
    margin-top: 40px;
    text-align: right;
}

.tv-submit-btn {
    background-color: #936179;
    color: #ffffff;
    border: 1px solid #936179;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(147, 97, 121, 0.15);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: none !important;
    min-width: 180px;
    justify-content: center;
}

.tv-submit-btn:hover {
    background-color: #794d62;
    border-color: #794d62;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(147, 97, 121, 0.25);
}

/* Brand specific theme overrides */
.tv-brand-tab[data-brand="newhair"].active~form .tv-submit-btn,
.tv-brand-tab[data-brand="newhair"].active~form .tv-radio-label input[type="radio"]:checked+.tv-custom-radio {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.tv-brand-tab[data-brand="newhair"].active~form .tv-submit-btn:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

/* --- Specificity Overrides for Container Layout Sanitization --- */
.tv-tablet-form .tv-grid-row {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    /* Ensure absolute child dropdowns are not clipped */
}

.tv-tablet-form .tv-grid-row.cols-2>* {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}

.tv-tablet-form .tv-grid-row.cols-3>* {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}

.tv-tablet-form .tv-grid-row.cols-3-1>*:first-child {
    flex: 3 1 0% !important;
    min-width: 0 !important;
}

.tv-tablet-form .tv-grid-row.cols-3-1>*:last-child {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}

.tv-tablet-form input[type="text"].tv-custom-input,
.tv-tablet-form input[type="number"].tv-custom-input,
.tv-tablet-form input[type="tel"].tv-custom-input,
.tv-tablet-form input[type="email"].tv-custom-input,
.tv-tablet-form select.tv-custom-select,
.tv-tablet-form textarea.tv-custom-textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border: 1px solid #cbd5e1 !important;
    padding: 12px 16px !important;
    height: 48px !important;
    display: block !important;
    font-size: 15px !important;
    line-height: normal !important;
    transition: all 0.2s ease !important;
    background-color: #ffffff !important;
    outline: none !important;
    border-radius: 8px !important;
}

.tv-tablet-form textarea.tv-custom-textarea {
    height: auto !important;
    min-height: 120px !important;
}

.tv-tablet-form .tv-form-field {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    /* Ensure absolute child dropdowns are not clipped */
}

/* --- TV_Search_Field Specificity Overrides --- */
.tv-tablet-form .tv-full-width-search {
    max-width: 100% !important;
    width: 100% !important;
}

.tv-tablet-form .tv-search-wrapper {
    max-width: 100% !important;
    width: 100% !important;
}

.tv-tablet-form .tv-search-icon {
    display: none !important;
    /* Hide search icon to look like a standard text input */
}

.tv-tablet-form .tv-search-input {
    padding: 12px 16px !important;
    /* Restore normal input padding (no space reserved for search icon) */
}

/* --- TV_Date_Picker Styling overrides for forms --- */
.tv-tablet-form .tv-date-picker-wrapper.tv-date-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

.tv-tablet-form .tv-date-picker-trigger.tv-date-picker-trigger {
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 8px !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    font-size: 15px !important;
    font-family: inherit !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
    text-transform: none !important;
}

.tv-tablet-form .tv-date-picker-trigger.tv-date-picker-trigger:hover {
    border-color: #cbd5e1 !important;
    background-color: #f8fafc !important;
    transform: none !important;
}

.tv-tablet-form .tv-date-picker-current-val {
    display: inline-block !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    text-transform: none !important;
}

.tv-tablet-form .tv-date-picker-icon {
    order: 2 !important;
    /* Move icon to the right side of the field */
    color: #64748b !important;
    font-size: 16px !important;
}

.tv-tablet-form .tv-date-picker-dropdown.tv-date-picker-dropdown {
    width: 320px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* Reset fixed width & floating box-shadow when date picker is in inline mode */
.tv-tablet-form .tv-date-picker-wrapper.is-inline-tablet .tv-date-picker-dropdown,
.tv-tablet-form .tv-date-picker-wrapper.is-inline-mobile .tv-date-picker-dropdown,
.tv-tablet-form .tv-date-picker-wrapper.is-inline-all .tv-date-picker-dropdown {
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Required Field Asterisk */
.tv-required-asterisk {
    color: #ef4444 !important;
    margin-left: 3px !important;
    font-weight: bold !important;
}

/* Error validation styling */
.tv-form-field.has-error .tv-field-label {
    color: #ef4444 !important;
}

.tv-form-field.has-error .tv-custom-input,
.tv-form-field.has-error .tv-search-input,
.tv-form-field.has-error .tv-email-input,
.tv-form-field.has-error .tv-country-trigger,
.tv-form-field.has-error .tv-phone-field-wrapper,
.tv-form-field.has-error .tv-date-picker-trigger,
.tv-form-field.has-error .tv-date-picker-wrapper.is-inline-tablet .tv-date-picker-dropdown,
.tv-form-field.has-error .tv-date-picker-wrapper.is-inline-mobile .tv-date-picker-dropdown,
.tv-form-field.has-error .tv-date-picker-wrapper.is-inline-all .tv-date-picker-dropdown {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
}

/* ==========================================================================
   WIZARD PROGRESS & NAVIGATION STYLING
   ========================================================================== */

/* Progress Container */
.tv-wizard-progress {
    position: relative;
    margin-bottom: 40px;
    padding: 0 10px;
}

/* Progress Line behind step circles */
.tv-progress-line-container {
    position: absolute;
    top: 18px;
    left: 10%;
    right: 10%;
    height: 4px;
    background-color: #e2e8f0;
    z-index: 1;
    border-radius: 4px;
}

.tv-progress-line-fill {
    height: 100%;
    width: 0%;
    background-color: var(--color-primary, #936179);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

/* Step Circle & Labels list */
.tv-progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.tv-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
    user-select: none;
}

/* Step Circles */
.tv-progress-step .step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    transition: all 0.25s ease;
}

.tv-progress-step .step-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.25s ease;
    text-align: center;
}

/* Active Step */
.tv-progress-step.active .step-num {
    border-color: var(--color-primary, #936179);
    background-color: var(--color-primary, #936179);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(147, 97, 121, 0.15);
}

.tv-progress-step.active .step-label {
    color: var(--color-text, #1e293b);
    font-weight: 700;
}

/* Completed Step */
.tv-progress-step.completed .step-num {
    border-color: var(--color-primary, #936179);
    background-color: #ffffff;
    color: var(--color-primary, #936179);
}

.tv-progress-step.completed .step-label {
    color: var(--color-primary, #936179);
}

/* Navigation Buttons */
.tv-form-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    border-top: 1px solid #e2e8f0;
    padding-top: 25px;
    align-items: center;
    gap: 20px;
}

.tv-form-navigation .tv-nav-btn {
    padding: 12px 28px !important;
    border-radius: 100px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer;
    border: 1px solid #cbd5e1 !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease !important;
    height: auto !important;
    line-height: normal !important;
    text-transform: none !important;
    min-width: 140px !important;
}

.tv-form-navigation .tv-next-btn {
    background-color: var(--color-primary, #936179) !important;
    color: #ffffff !important;
    border-color: var(--color-primary, #936179) !important;
    margin-left: auto;
}

.tv-form-navigation .tv-next-btn:hover {
    background-color: #794d62 !important;
    border-color: #794d62 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(147, 97, 121, 0.2);
}

/* Redefine hover for Blue brand theme */
.tv-brand-tab[data-brand="newhair"].active~form .tv-form-navigation .tv-next-btn:hover {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.tv-form-navigation .tv-prev-btn {
    background-color: #ffffff !important;
    color: #475569 !important;
}

.tv-form-navigation .tv-prev-btn:hover {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
}

.tv-form-navigation .tv-submit-btn {
    background-color: var(--color-primary, #936179) !important;
    border-color: var(--color-primary, #936179) !important;
    color: #ffffff !important;
    padding: 12px 36px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 100px !important;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(147, 97, 121, 0.15) !important;
    transition: all 0.2s ease !important;
    margin-left: auto;
    text-transform: none !important;
    min-width: 160px;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tv-form-navigation .tv-submit-btn:hover {
    background-color: #794d62 !important;
    border-color: #794d62 !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(147, 97, 121, 0.2) !important;
}

.tv-brand-tab[data-brand="newhair"].active~form .tv-form-navigation .tv-submit-btn:hover {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2) !important;
}

@media (max-width: 576px) {
    .tv-progress-step .step-label {
        display: none;
        /* Hide step labels on tiny mobile viewports to avoid overlapping */
    }

    .tv-progress-line-container {
        left: 20px;
        right: 20px;
    }
}

/* --- Summary Page Styling --- */
.tv-summary-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 20px;
}

.tv-summary-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.tv-summary-card-header {
    background: #f8fafc;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-summary-card-header i {
    color: #936179;
}

.tv-brand-tab[data-brand="newhair"].active ~ form .tv-summary-card-header i {
    color: #3b82f6;
}

.tv-summary-card-body {
    padding: 20px;
}

.tv-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .tv-summary-grid {
        grid-template-columns: 1fr;
    }
}

.tv-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tv-summary-item.tv-summary-full-width {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .tv-summary-item.tv-summary-full-width {
        grid-column: span 1;
    }
}

.tv-summary-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tv-summary-value {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    min-height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

/* --- Locked state styling --- */
.tv-form-page.tv-locked {
    opacity: 0.85;
}

.tv-progress-step.tv-locked {
    cursor: default !important;
    pointer-events: none;
}

.tv-progress-step.tv-locked .step-num {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
}

.tv-progress-step.tv-locked.completed .step-num {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
}
.tv-progress-step.tv-locked.active .step-num {
    background-color: var(--color-primary, #936179) !important;
    border-color: var(--color-primary, #936179) !important;
    color: #ffffff !important;
}

.tv-toggle-box.tv-locked {
    pointer-events: none !important;
    opacity: 0.7;
}

/* Ensure disabled inputs are clearly readable but look inactive */
.tv-form-page input:disabled,
.tv-form-page select:disabled,
.tv-form-page textarea:disabled {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed;
    opacity: 1; /* Override iOS opacity */
}

/* --- Summary Lock & Review Sections --- */
.tv-summary-lock-section {
    margin-top: 30px;
    text-align: center;
    padding: 25px;
    background: #faf7f8;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.tv-brand-tab[data-brand="newhair"].active ~ form .tv-summary-lock-section h4 {
    color: #3b82f6;
}

.tv-summary-lock-section h4 {
    color: #936179;
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 600;
}

.tv-summary-lock-section p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.tv-summary-review-section {
    margin-top: 30px;
    text-align: center;
}

/* --- Redirect Countdown Modal --- */
.tv-countdown-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 15px;
    color: #10b981;
}

.tv-brand-tab[data-brand="newhair"].active ~ form .tv-countdown-number {
    color: #3b82f6 !important;
}

.tv-countdown-number {
    font-size: 18px;
    color: #936179;
    font-weight: 700;
}

.tv-countdown-text {
    font-size: 16px;
    line-height: 1.5;
    color: #475569;
    margin-bottom: 25px;
}

.tv-countdown-title {
    margin-top: 0;
    color: #10b981;
    font-size: 22px;
    font-weight: 600;
}

.tv-countdown-btn {
    width: 100%;
    justify-content: center;
    height: 48px;
    border-radius: 100px;
}

/* --- XML Download Button --- */
.tv-xml-download-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none !important;
}

.tv-xml-download-btn i {
    margin-right: 8px;
}

/* --- Extracted Styles from medical_history.php --- */
.tv-qr-container {
    display: inline-block;
    text-align: center;
    padding: 15px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.tv-qr-label {
    margin-top: 10px;
    font-family: var(--font-family);
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 600;
}

.tv-submit-btn,
.tv-nav-btn {
    transition: all 0.25s ease-in-out;
}

.tv-submit-btn.is-loading,
.tv-nav-btn.is-loading {
    opacity: 0.8;
    pointer-events: none;
    cursor: wait;
}

.tv-submit-btn.is-success,
.tv-nav-btn.is-success {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    transform: scale(1.02);
}

#tv-qr-reader {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

#tv-scanner-status {
    margin-top: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.tv-portal-title.tv-top-margin {
    margin-top: 10px;
}

.tv-treatments-empty-msg {
    text-align: left;
    margin: 0;
    font-size: 14px;
}

.tv-allergies-field-wrap {
    margin-bottom: 25px;
}

.tv-marketing-details {
    margin-top: 15px;
}

#tv-marketing-recommendation-wrap,
#tv-marketing-other-wrap,
.tv-hidden-marketing-wrap {
    display: none;
    margin-bottom: 15px;
}

/* --- Privacy Policy Accordion Section (Summary Page) --- */
.tv-privacy-accordion-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s ease;
}

.tv-privacy-accordion-header:hover {
    background-color: #f1f5f9;
}

.tv-privacy-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.tv-privacy-accordion-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
}

.tv-privacy-toggle-icon {
    transition: transform 0.25s ease;
}

.tv-privacy-accordion-header.is-open .tv-privacy-toggle-icon {
    transform: rotate(180deg);
}

.tv-privacy-accordion-body {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

.tv-privacy-iframe {
    width: 100%;
    height: 480px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    display: block;
    background: #ffffff;
    pointer-events: auto;
}

.tv-privacy-checkbox-card-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.tv-privacy-checkbox-wrap {
    margin-top: 0;
}

.tv-privacy-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 15px;
    color: #1e293b;
    cursor: pointer;
    line-height: 1.5;
    transition: opacity 0.2s ease;
}

.tv-privacy-label.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tv-privacy-label.tv-review-disabled {
    opacity: 0.8;
    cursor: default;
    pointer-events: none;
}

.tv-privacy-label.disabled input[type="checkbox"],
.tv-privacy-label.tv-review-disabled input[type="checkbox"] {
    cursor: not-allowed;
    pointer-events: none;
}

.tv-privacy-disabled-hint {
    font-size: 13px;
    color: #64748b;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-privacy-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.tv-privacy-error {
    margin-top: 8px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
}

/* --- Disabled/Greyed-Out Save Button State --- */
.tv-submit-btn:disabled,
.tv-submit-btn.disabled,
.tv-form-navigation .tv-submit-btn:disabled,
.tv-form-navigation .tv-submit-btn.disabled {
    background-color: #cbd5e1 !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none !important;
}

