/* Modern Multi-Step Registration Form - Bootstrap 5 Compatible */

:root {
    --primary-color: #F97316;
    --primary-hover: #EA580C;
    --secondary-color: #1F2937;
    --border-color: #E5E7EB;
    --text-muted: #6B7280;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --light-bg: #F9FAFB;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Container & Layout */
.registration-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #FFF7ED 0%, #FFFFFF 100%);
    padding: 2rem 0;
}

.registration-wrapper {
    max-width: 900px;
    margin: 0 auto;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Progress Bar */
.progress-header {
    background: #FFFFFF;
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2rem;
}

.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.progress-step::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.progress-step:first-child::before {
    display: none;
}

.progress-step.active::before,
.progress-step.completed::before {
    background: var(--primary-color);
}

.progress-step-circle {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem;
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.progress-step.active .progress-step-circle {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.progress-step.completed .progress-step-circle {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.progress-step-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.progress-step.active .progress-step-label,
.progress-step.completed .progress-step-label {
    color: var(--secondary-color);
}

/* Form Content */
.form-content {
    padding: 2rem;
}

.form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

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

.step-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.step-description {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Theme Selection Cards — the card IS the control.
   Click anywhere on a card to select it; selection reads as an orange
   ring + corner check. Preview is a quiet pill that appears on hover.
   No Select/Selected buttons. */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem 1.25rem;
    margin-bottom: 2rem;
    align-items: start;
    padding: 0.5rem 0;
}

.theme-card-wrapper {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    cursor: pointer;
    outline: none;
}

.theme-card-wrapper:focus-visible .theme-card {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.35);
}

/* Card is the image */
.theme-card {
    position: relative;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    aspect-ratio: 387 / 437;
    background: #F3F4F6;
}

.theme-card-wrapper:hover .theme-card {
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.12);
    transform: translateY(-3px);
}

.theme-card.selected {
    border-color: #F97316;
    box-shadow: 0 0 0 2px #F97316;
}

.theme-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* Selected indicator — small check disc in the image corner */
.theme-selected-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    background: #F97316;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.theme-selected-indicator i {
    font-size: 12px;
}

.theme-card.selected .theme-selected-indicator {
    transform: scale(1);
}

/* Caption below the card: name, with a quiet selected tint */
.theme-card-info {
    text-align: left;
    padding: 0 0.15rem;
}

.theme-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
    overflow-wrap: anywhere;
    transition: color 0.2s ease;
}

.theme-card-wrapper.selected .theme-card-title {
    color: #111827;
}

.theme-card-description {
    font-size: 0.8125rem;
    color: #6B7280;
    line-height: 1.3;
}

/* Preview — quiet pill, appears on hover/focus over the image */
.btn-preview-theme {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translate(-50%, 6px);
    padding: 0.4rem 1rem;
    border: 0;
    border-radius: 50rem;
    background: rgba(17, 24, 39, 0.82);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-card-wrapper:hover .btn-preview-theme,
.theme-card-wrapper:focus-visible .btn-preview-theme,
.btn-preview-theme:focus-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.btn-preview-theme:hover {
    background: rgba(17, 24, 39, 0.95);
}

/* Form Groups */
.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-color);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.required-star {
    color: var(--danger-color);
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: none;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Clinic Hours Component */
.clinic-hours-tabs {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    background: var(--light-bg);
}

.day-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.day-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--secondary-color);
}

.day-tab:hover {
    background: var(--light-bg);
}

.day-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.hours-content {
    display: none;
}

.hours-content.active {
    display: block;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.time-input-group {
    flex: 1;
    position: relative;
}

.time-input-group input {
    padding-right: 2.5rem;
}

.time-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.availability-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: var(--success-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Service Selection — category rail + multi-select chips.
   Categories (parent clinic types) sit on the left with counts;
   the panel scrolls internally so the page never grows. Selection
   reads as an orange ring + corner check (theme-picker grammar). */
.svc-selector {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.svc-rail {
    border-right: 1px solid var(--border-color, #E5E7EB);
    background: #F9FAFB;
    padding: 0.5rem 0;
    max-height: 480px;
    overflow-y: auto;
}

.svc-rail__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.9rem 0.6rem 0.75rem;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4B5563;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.svc-rail__item:hover {
    background: #F3F4F6;
    color: #111827;
}

.svc-rail__item.is-active {
    background: #FFF7ED;
    border-left-color: #F97316;
    color: #111827;
}

.svc-rail__name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.svc-rail__count {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #6B7280;
    background: #fff;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 50rem;
    padding: 0.1rem 0.5rem;
    min-width: 2rem;
    text-align: center;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.svc-rail__count.has-selected {
    color: #F97316;
    border-color: #FED7AA;
    background: #FFF7ED;
}

.svc-panel {
    display: flex;
    flex-direction: column;
    max-height: 480px;
    min-width: 0;
}

.svc-panel__summary {
    flex: 0 0 auto;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-color, #E5E7EB);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6B7280;
}

.svc-panel__grid {
    flex: 1 1 auto;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-content: start;
    padding: 1rem;
}

.svc-panel__empty {
    padding: 1.25rem 1rem;
    margin: 0;
}

.service-item {
    position: relative;
}

.service-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.service-label {
    position: relative;
    display: block;
    height: 100%;
    padding: 0.7rem 2.2rem 0.7rem 0.9rem;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    text-align: left;
    font-size: 0.875rem;
    background: white;
}

/* Corner check disc, springs in when chosen */
.service-label::after {
    content: '\2713';
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #F97316;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.service-name {
    display: block;
    font-weight: 700;
    line-height: 1.3;
    color: #374151;
}

.service-description {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted, #6B7280);
    font-size: 0.75rem;
    line-height: 1.35;
}

.service-checkbox:checked + .service-label {
    border-color: #F97316;
    box-shadow: 0 0 0 1px #F97316;
    background: #FFF7ED;
}

.service-checkbox:checked + .service-label::after {
    transform: scale(1);
}

.service-checkbox:checked + .service-label .service-name {
    color: #111827;
}

.service-checkbox:focus-visible + .service-label {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.35);
}

.service-label:hover {
    border-color: #FDBA74;
}

@media (max-width: 767.98px) {
    .svc-selector {
        grid-template-columns: minmax(0, 1fr);
    }

    .svc-rail {
        display: flex;
        gap: 0.25rem;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border-color, #E5E7EB);
        padding: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .svc-rail__item {
        flex: 0 0 auto;
        width: auto;
        border-left: 0;
        border-radius: 50rem;
        border: 1px solid transparent;
        padding: 0.4rem 0.8rem;
    }

    .svc-rail__item.is-active {
        border-color: #F97316;
    }

    .svc-panel__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .svc-panel {
        max-height: 420px;
    }
}

.custom-service-row .btn {
    width: 100%;
    min-height: 46px;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: var(--light-bg);
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(249, 115, 22, 0.02);
}

.file-upload-area.has-file {
    border-style: solid;
    border-color: var(--success-color);
}

.file-upload-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.file-upload-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.file-preview {
    margin-top: 1rem;
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
}

/* Navigation Buttons */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--light-bg);
}

.form-navigation .ms-auto {
    margin-left: auto;
}

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.btn-previous {
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--border-color);
}

.btn-previous:hover {
    background: var(--light-bg);
}

.btn-next,
.btn-submit {
    background: var(--primary-color);
    color: white;
}

.btn-next:hover,
.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Theme Preview Modal - Full Professional View */
.theme-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.theme-preview-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 1600px;
    height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #FFFFFF;
}

.modal-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
    font-weight: 600;
}

.device-switcher {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: 1rem;
}

.device-btn {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6B7280;
}

.device-btn:hover {
    border-color: #9CA3AF;
    background: #F9FAFB;
}

.device-btn.active {
    background: #1F2937;
    color: white;
    border-color: #1F2937;
}

.close-btn {
    background: white;
    border: 1px solid #E5E7EB;
    font-size: 1.25rem;
    cursor: pointer;
    color: #6B7280;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #EF4444;
    color: white;
    border-color: #EF4444;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.preview-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.preview-container.mobile-view {
    max-width: 375px;
    height: 90%;
}

.preview-container.tablet-view {
    max-width: 768px;
    height: 95%;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .registration-wrapper {
        margin: 1rem;
        border-radius: 12px;
    }
    
    .progress-steps {
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    
    .progress-step-label {
        font-size: 0.75rem;
    }
    
    .theme-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }
    
    .form-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
    }
    
    .day-tabs {
        justify-content: center;
    }
    
    .service-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .step-title {
        font-size: 1.5rem;
    }
    
    .theme-grid {
        grid-template-columns: 1fr;
    }
    
    .time-inputs {
        flex-direction: column;
    }
    
    .time-input-group {
        width: 100%;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .form-navigation,
    .btn-preview-theme {
        display: none !important;
    }
}
