/* Clinic Live Wizard UI
   Version 5.1.1
   - Fixed face visibility (no black box)
   - Correct 3D flip logic
   - Smooth transitions and layered z-index
*/

/* RESET */
.cl-wrapper,
.cl-wrapper * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* FULLSCREEN STAGE */
.cl-wrapper {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    background: #000; /* fallback */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
    color: #000;
}

/* BACKGROUND VIDEO */
.cl-bg-video {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 40%, #1b1736 0%, #000 70%);
}
.cl-bg-video__el {
    position: absolute;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 0.55;
    filter: saturate(1.3) brightness(1.2);
}
.cl-audio-toggle {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: .8rem;
    border-radius: 6px;
    padding: .4rem .5rem;
    cursor: pointer;
    pointer-events: auto;
}

/* PANEL CONTAINER */
.cl-panel {
    position: relative;
    z-index: 1;
    width: min(90vw, 1100px);
    min-height: min(70vh, 700px);
    perspective: 2000px;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
}

.cl-panel.cl-flipped {
    transform: rotateY(180deg);
}

/* FACES */
.cl-front-face,
.cl-back-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.08);
    border-radius: 18px;
    box-shadow: 0 50px 140px rgba(0,0,0,0.85),
                0 4px 16px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    overflow: hidden;
    color: #000;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    transition: transform .6s ease;
}

/* Layer order */
.cl-front-face {
    z-index: 2;
    transform: rotateY(0deg);
}
.cl-back-face {
    z-index: 1;
    transform: rotateY(180deg);
}

/* Hidden state */
.cl-face-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* HEADER BAR */
.cl-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.5rem .75rem 1.5rem;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.65) 0%,
        rgba(255,255,255,0.15) 100%
    );
    border-bottom: 1px solid rgba(255,255,255,0.3);
    color: #000;
}

.cl-header-left {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.cl-logo-big img {
    max-height: 60px;
    width: auto;
}
.cl-logo-small img {
    max-height: 24px;
    width: auto;
}

.cl-header-right {
    text-align: right;
    font-size: .8rem;
    line-height: 1.2;
    color: #000;
}
.cl-step-indicator {
    font-weight: 500;
    color: #000;
    margin-bottom: .4rem;
}
.cl-progress-dots {
    font-size: 0;
}
.cl-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(0,0,0,0.2);
    margin-right: 3px;
}
.cl-dot--active {
    background: linear-gradient(135deg,#3636ff 0%,#6a40ff 100%);
}

/* BODY */
.cl-body {
    flex: 1 1 auto;
    padding: 2rem 2rem 2.5rem 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.cl-body-inner {
    flex: 1 1 auto;
    position: relative;
}

/* SLIDE CONTENT */
.cl-slide-wrapper {
    width: 100%;
    position: relative;
}
.cl-slide-content {
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 30px 80px rgba(0,0,0,0.15);
    color: #000;
    padding: 1.8rem;
    min-height: 340px;
    font-size: .9rem;
    line-height: 1.5;
    position: relative;
}

/* TRANSITIONS */
.enter-from-right {
    opacity: 0;
    transform: translateX(40px);
}
.enter-active {
    transition: all .5s ease;
    opacity: 1;
    transform: translateX(0);
}
.exit-to-left {
    transition: all .5s ease;
    opacity: 0;
    transform: translateX(-40px);
}

/* HEADERS */
.cl-slide-header {
    margin: 0 0 .75rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #000;
}
.cl-slide-desc {
    color: rgba(0,0,0,0.7);
    font-size: .9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

/* QUESTIONS */
.cl-qblock {
    margin-bottom: 1.2rem;
}
.cl-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: #000;
    margin-bottom: .4rem;
}

/* INPUTS */
.cl-input,
.cl-textarea {
    width: 100%;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.25);
    background: #fff;
    font-size: .85rem;
    line-height: 1.4;
    color: #000;
    padding: .6rem .7rem;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
.cl-textarea {
    min-height: 80px;
    resize: vertical;
}

/* REQUIRED FIELD ALERT */
.cl-required-empty {
    border-color: #d00 !important;
    box-shadow: 0 0 6px rgba(208,0,0,0.6) !important;
}

/* CONSENT NOTE */
.cl-consent-inline {
    font-size: .8rem;
    line-height: 1.3;
    color: rgba(0,0,0,0.8);
    margin-top: 1rem;
}

/* FOOTER BUTTONS */
.cl-footer-bar {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.5);
    border-top: 1px solid rgba(0,0,0,0.05);
}
.cl-btn {
    appearance: none;
    cursor: pointer;
    border-radius: 8px;
    border: 0;
    font-size: .8rem;
    font-weight: 600;
    padding: .8rem 1.2rem;
    min-width: 70px;
    text-align: center;
    box-shadow:
        0 14px 30px rgba(0,0,0,0.25),
        0 4px 8px rgba(0,0,0,0.4);
}
.cl-btn--back {
    background: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.8);
    border: 1px solid rgba(0,0,0,0.15);
}
.cl-btn--next {
    background: linear-gradient(135deg,#3636ff 0%,#6a40ff 100%);
    color: #fff;
    border: 0;
    box-shadow:
        0 20px 40px rgba(56,56,255,0.4),
        0 6px 12px rgba(0,0,0,0.4);
}
.cl-btn[disabled] {
    opacity: .4;
    cursor: not-allowed;
}

/* GENERATING OVERLAY */
.cl-generating-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,10,20,0.6);
    backdrop-filter: blur(12px) saturate(1.4);
    border-radius: 18px;
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 2rem;
}
.cl-gen-inner {
    width: 90%;
    max-width: 500px;
    background: rgba(0,0,20,0.6);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 16px;
    box-shadow: 0 40px 120px rgba(0,0,0,0.8);
    padding: 2rem;
    text-align: center;
}
.cl-gen-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: rgba(255,255,255,0.9);
    animation: clSpin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}
@keyframes clSpin { to { transform: rotate(360deg); } }

/* REPORT VIEW */
.cl-report-view {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.98);
    border-radius: 18px;
    z-index: 998;
    overflow-y: auto;
    color: #000;
    padding: 2rem;
    display: none;
    justify-content: center;
    align-items: flex-start;
}
.cl-report-inner {
    width: 90%;
    max-width: 900px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 30px 80px rgba(0,0,0,0.25);
    padding: 2rem;
}
.cl-report-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}
.cl-report-body {
    white-space: pre-wrap;
    color: #000;
    margin-bottom: 2rem;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
}
.cl-report-actions {
    text-align: right;
}
#cl-download-btn {
    background: linear-gradient(135deg,#3636ff 0%,#6a40ff 100%);
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-size: .8rem;
    font-weight: 600;
    padding: .8rem 1.2rem;
    box-shadow:
        0 20px 40px rgba(56,56,255,0.4),
        0 6px 12px rgba(0,0,0,0.4);
    cursor: pointer;
}

/* BACK FACE FIXES */
.cl-back-face .cl-body,
.cl-back-face .cl-slide-content {
    opacity: 1 !important;
    visibility: visible !important;
    color: #000 !important;
}
