/* Base variables using your brand colors */
:root {
    --primary-color: #592260;
    --primary-color-light: #f3e9f4;
    --secondary-color: #00a89c; /* Teal accent */
}

/* ============= ENHANCED FORM COMPONENTS ============= */

/* Form Step Header */
.form-step-header {
    margin-bottom: 2rem;
}

.form-step-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.form-step-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.5;
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Plan Selection Cards */
.plan-selection-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.plan-selection-card:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 168, 156, 0.15);
}

.plan-selection-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color-light), rgba(0, 168, 156, 0.05));
}

.plan-selection-card .plan-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.plan-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.plan-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.plan-features li {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.plan-features li i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

/* Family Member Cards */
.family-member-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.family-member-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
}

.family-member-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}
.remove-member-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
    margin-left: 8px;
}

.remove-member-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.family-tab .remove-member-btn {
    width: 16px;
    height: 16px;
    margin-left: 4px;
}

.summary-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.summary-label {
    font-weight: 500;
    color: #374151;
}

.summary-value {
    font-weight: 600;
    color: #1f2937;
}

/* Consent Section */
.consent-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

/* Checkbox Styling */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 2rem;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--secondary-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
}

.text-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.text-link:hover {
    color: var(--secondary-color);
}

/* General Form Styling */
.form-step {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}
.form-step.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Container Smooth Transitions */
#healthInsuranceForm {
    transition: opacity 0.2s ease-in-out;
}

.form-field {
    margin-bottom: 1.25rem;
    position: relative; /* Needed for error messages */
}

.grid .form-field:last-child {
    margin-bottom: 0;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    color: #1f2937;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

.form-field-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.form-step-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: left;
}

/* Validation Styling */
.form-input.invalid, .form-select.invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px #fee2e2;
}

.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none; /* Hidden by default */
}

/* Step Indicator Styling */
.step-indicator {
    display: flex;
    align-items: center;
    opacity: 0.5;
    transition: all 0.3s ease;
    padding-left: 4px;
    border-left: 4px solid transparent;
}
.step-indicator .step-indicator-desc {
    display: none;
}
.step-indicator.active {
    opacity: 1;
    border-left-color: var(--secondary-color);
    transform: translateX(5px);
}
.step-indicator.active .step-indicator-title {
    font-weight: 700;
}
.step-indicator.active .step-indicator-desc {
    display: block;
}
.step-indicator.completed {
    opacity: 1;
}
.step-indicator.completed .step-indicator-icon {
    background-color: var(--secondary-color);
    color: white;
}
.step-indicator-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    transition: background-color 0.3s ease;
}
.step-indicator-title {
    font-weight: 600;
    color: #ffffff;
}
.step-indicator-desc {
    font-size: 0.875rem;
    color: #d8b4fe;
    opacity: 0.9;
}

/* Health Form Specific Styles */
.plan-selection-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
    height: 100%;
}
.plan-selection-box:hover, .plan-selection-box:focus {
    border-color: var(--primary-color);
    background-color: var(--primary-color-light);
    transform: translateY(-4px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.plan-selection-box i {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}
.plan-selection-box-title {
    font-weight: 600;
    color: #1f2937;
}

.category-row {
    display: grid;
    grid-template-columns: 1fr 120px 40px;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
}
.remove-category-btn {
    height: 42px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fef2f2;
    color: #ef4444;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}
.remove-category-btn:hover {
    background-color: #fee2e2;
}

.member-details-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* intl-tel-input Customization */
.iti {
    width: 100%;
}
.iti__country-list {
    z-index: 110; /* Ensure dropdown is above other content */
}
.iti .form-input {
    padding-left: 52px; /* Adjust based on flag width */
}
#preloader {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #ffffff;
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        transition: opacity 0.75s ease, visibility 0.75s ease;
    }
    .preloader-logo {
        width: 80px;
        animation: pulse 1.5s ease-in-out infinite;
    }
    #preloader.loaded {
        opacity: 0;
        visibility: hidden;
    }
    @keyframes pulse {
        0% {
            transform: scale(1);
            opacity: 1;
        }
        50% {
            transform: scale(1.1);
            opacity: 0.7;
        }
        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

/* Family Members Tab System */
.family-members-container {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.family-tabs-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 2px solid #e2e8f0;
    padding: 0;
    display: flex;
    overflow-x: auto;
}

.family-tab {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
    justify-content: center;
}

.family-tab:hover {
    color: var(--secondary-color);
    background: rgba(0, 168, 156, 0.05);
}

.family-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(89, 34, 96, 0.05);
}

.family-tab.completed {
    color: var(--secondary-color);
    background: rgba(0, 168, 156, 0.1);
}

.family-tab.completed::after {
    content: '✓';
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.family-tab-content {
    padding: 2rem;
    display: none;
}

.family-tab-content.active {
    display: block;
}

.add-member-tab {
    background: rgba(0, 168, 156, 0.1);
    color: var(--secondary-color);
    border: 2px dashed var(--secondary-color);
    border-radius: 8px;
    margin: 0.5rem;
}

.add-member-tab:hover {
    background: rgba(0, 168, 156, 0.2);
    border-style: solid;
}

.family-member-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.member-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

/* Tooltip for family member tabs */
.family-tab:not(.add-member-tab) {
    position: relative;
}

.family-tab:not(.add-member-tab):hover::after {
    content: 'Click to edit this member';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.family-tab:not(.add-member-tab):hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}

/* Enhanced Form Fields */
.enhanced-form-field {
    margin-bottom: 1.5rem;
    position: relative;
}

.enhanced-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.enhanced-input, .enhanced-select, .enhanced-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.enhanced-input:focus, .enhanced-select:focus, .enhanced-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(89, 34, 96, 0.1);
}

.enhanced-input.error, .enhanced-select.error, .enhanced-textarea.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.enhanced-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

/* Date Picker Group */
.date-picker-group {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 0.75rem;
}

.date-select select {
    width: 100%;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background-color: #ffffff;
}

.date-select label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

/* Member Navigation */
.member-navigation {
    border-top: 1px solid #e5e7eb;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.btn-secondary {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(89, 34, 96, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Error Messages */
.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}

.has-error .error-message {
    display: block;
}

/* Success Button */
.btn-success {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Member Progress */
.member-progress {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

/* Enhanced intl-tel-input styling */
.iti {
    width: 100%;
    display: block;
}

.iti__country-list {
    z-index: 1000;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.iti__selected-flag {
    padding: 0 8px;
}

.iti input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 52px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.iti input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(89, 34, 96, 0.1);
}
