/* Posture Evaluation Plugin Styles */

.posture-upload-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

/* Hidden elements required by QNR system */
.posture-loading {
    text-align: center;
    padding: 15px;
    background: #e7f3ff;
    border: 1px solid #007cba;
    border-radius: 6px;
    font-weight: bold;
    color: #005a87;
    margin: 15px 0;
}

.posture-results {
    text-align: center;
    margin-top: 20px;
}

.posture-result-image {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 20px auto;
    display: block;
}

.posture-analysis-result {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border-left: 4px solid #007cba;
    text-align: left;
    line-height: 1.6;
}

.posture-analyze-btn {
    padding: 12px 24px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

#posture-upload {
    padding: 10px;
    border: 2px dashed #007cba;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

#posture-upload:hover {
    border-color: #005a87;
    background: #f0f8ff;
}







/* Posture Status Messages */
.posture-status {
    margin: 10px 0;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    background: #e7f3ff;
    border: 1px solid #007cba;
    color: #005a87;
}

.posture-status.error {
    background: #ffebee;
    border-color: #e74c3c;
    color: #c62828;
}

.posture-status .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #007cba;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Skip posture analysis button */
.posture-error-with-skip {
    text-align: center;
}

.qnr-skip-posture {
    margin-top: 10px;
    padding: 8px 16px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.qnr-skip-posture:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.qnr-skip-posture:active {
    transform: translateY(0);
}

/* Test API button */
.qnr-test-api {
    margin-right: 10px;
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.qnr-test-api:hover {
    background: #218838;
    transform: translateY(-1px);
}

.qnr-test-api:active {
    transform: translateY(0);
}

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

/* Report Generation Animation Styles - Moved to loading.css */

/* Submit button states */
.qnr-submit.analyzing {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .posture-status {
        font-size: 13px;
        padding: 8px;
    }
}

/* ================== NEW INTERFACE STYLES ================== */

/* Relaxed mode checkbox */
.qnr-posture-mode {
    /* text-align: center;
    margin-bottom: 20px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0; */

    display: none !important;
}

.qnr-posture-mode label {
    /* display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333; */

    display: none !important;
}

.qnr-posture-mode input[type="checkbox"] {
    /* cursor: pointer;
    width: 18px;
    height: 18px; */

    display: none !important;
}

/* Upload layout */
.qnr-uploader-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

/* Button group container */
.qnr-button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.qnr-button-group .qnr-posture-btn {
    width: 100%;
    justify-content: center;
}

.qnr-uploader-layout.is-hidden {
    display: none;
}

.qnr-dropzone {
    position: relative;
    border: 2px dashed #94a3b8;
    border-radius: 14px;
    padding: 26px 24px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qnr-dropzone:hover,
.qnr-dropzone.is-dragover {
    border-color: #2563eb;
    background: #eef2ff;
}

.qnr-drop-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.qnr-drop-icon svg {
    display: block;
    margin: 0 auto;
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.qnr-drop-title {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

/* Show desktop text by default, hide mobile */
.qnr-drop-title-mobile {
    display: none;
}

/* On mobile/tablet, show mobile text and hide desktop */
@media (max-width: 768px) {
    .qnr-drop-title-desktop {
        display: none;
    }
    
    .qnr-drop-title-mobile {
        display: block;
    }
}

.qnr-drop-subtitle {
    font-size: 12px;
    color: #475467;
    margin: 0;
}

.qnr-dropzone.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.qnr-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

.qnr-divider {
    position: relative;
    text-align: center;
    color: #475467;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
}

.qnr-divider::before,
.qnr-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30px;
    height: 1px;
    background: #e2e8f0;
}

.qnr-divider::before {
    left: 0;
}

.qnr-divider::after {
    right: 0;
}

/* Button base styles */
.qnr-posture-btn {
    padding: 14px 26px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.qnr-posture-btn svg {
    display: inline-block;
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.qnr-posture-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.2);
    color: inherit;
    transform: none !important;
}

/* Button color variants */
.qnr-btn-primary {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}

.qnr-btn-primary:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.qnr-btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

.qnr-btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
    color: #fff;
}

.qnr-btn-danger {
    background: linear-gradient(90deg, #f43f5e, #e11d48);
    color: #fff;
}

.qnr-btn-danger:hover {
    background: linear-gradient(90deg, #e11d48, #be123c);
}

.qnr-btn-warning {
    background: #ff9800;
    color: #fff;
}

.qnr-btn-warning:hover {
    background: #f57c00;
}


/* File status card */
.qnr-file-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e8f7ef;
    border: 1px solid #34d399;
    color: #065f46;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.qnr-file-status.is-success {
    background: #e8f7ef;
    border-color: #34d399;
    color: #065f46;
}

.qnr-file-status.is-info {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #0c4a6e;
}

.qnr-file-status.is-error {
    background: #fee2e2;
    border-color: #f87171;
    color: #7f1d1d;
}

.qnr-file-status button {
    background: none;
    border: none;
    font-size: 18px;
    color: inherit;
    cursor: pointer;
    display: none;
}

/* Camera zone */
.qnr-camera-panel {
    text-align: center;
    margin-bottom: 20px;
    padding: 18px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.qnr-camera-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

#qnr-video-container {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 100%;
    max-height: 85vh; /* keep whole camera area within one screen */
}

#qnr-video {
    display: block;
    max-width: 100%;
    width: 640px;
    height: auto;
    background: #000;
    border-radius: 8px;
    /* Unmirror front camera (facingMode:user) so left/right are natural */
    transform: scaleX(-1);
    transform-origin: center;
    object-fit: contain;
    max-height: 85vh; /* avoid multi-scroll camera area */
}

#qnr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 20; /* Above guide overlay so skeleton/countdown are visible */
    /* Match video mirroring so drawings align */
    transform: scaleX(-1);
    transform-origin: center;
}

/* Overlay ghid poziționare corp */
.qnr-posture-guide-overlay {
    position: absolute;
    top: 0;
    left: 0;
	right: 0;
	bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 5; /* Below canvas overlay so skeleton draws on top */
    pointer-events: none;
    display: none;
    align-items: stretch; /* Stretch to fill height */
    justify-content: center;
    background: rgba(0, 0, 0, 0.15); /* Reduced from 0.25 to 0.15 - less dark overlay */
    overflow: hidden; /* Crop sides if needed */
    transition: opacity 0.5s ease;
    /* Don't mirror the overlay container - mirror only the image inside */
}

.qnr-posture-guide-overlay.qnr-guide-visible {
    display: flex;
}

.qnr-posture-guide-overlay.qnr-guide-pulse .qnr-posture-guide-img {
    animation: qnr-guide-pulse 1.5s ease-in-out 3;
}

@keyframes qnr-guide-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Container pentru imagine cu background negru pentru letterbox */
.qnr-posture-guide-img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover = fill entire container, crop sides as needed */
    object-position: center center;
    opacity: 0.35; /* Increased from 0.35 to 0.65 for much better visibility */
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.4));
    /* Mirror the guide image to match the video orientation */
    transform: scaleX(-1);
    transform-origin: center center;
}

/* Portrait orientation: ensure full height is filled and crop left/right */
.qnr-posture-guide-overlay.qnr-guide-portrait .qnr-posture-guide-img {
	width: auto;
	height: 100%;
	object-fit: cover;
	object-position: center center;
}

/* Desktop/Landscape: also ensure full height is filled and crop sides */
.qnr-posture-guide-overlay.qnr-guide-landscape .qnr-posture-guide-img {
	width: auto;
	height: 100%;
	object-fit: cover;
	object-position: center center;
}

#qnr-canvas {
    display: none;
}

.qnr-terms-note {
    margin-top: 16px;
    font-size: 13px;
    color: rgba(71, 84, 103, 0.9);
    font-style: italic;
    text-align: center;
}

/* Live status indicator */
.qnr-live-status {
    margin: 12px 0;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    border-radius: 6px;
    background: #f0f8ff;
    border: 1px solid #0073aa;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================== NUDGE OVERLAY SYSTEM ================== */

/* Overlay container - fixed position covering entire viewport */
.qnr-nudge-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    animation: qnr-nudge-fadein 0.3s ease-out;
}

.qnr-nudge-overlay.qnr-nudge-visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qnr-camera-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999999 !important;
    display: none;
    animation: qnr-nudge-fadein 0.3s ease-out;
    /* Modal covers everything, no body scroll */
    overflow: hidden;
}

.qnr-camera-modal.is-visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Semi-transparent backdrop */
.qnr-nudge-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.qnr-camera-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999998 !important;
}

/* Content container with avatar and bubble - MARE pentru vizibilitate de la 3m */
.qnr-nudge-content {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 32px;
	max-width: 95%;
	width: 900px;
    animation: qnr-nudge-scalein 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1;
	/* Ensure content always fits viewport height */
	max-height: calc(100vh - 40px);
	overflow: hidden;
}

.qnr-camera-modal-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 95%;
    width: min(900px, 94vw);
    animation: qnr-nudge-scalein 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999999 !important;
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 36px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    /* 15px from top and bottom of viewport, content scrolls inside */
    margin: 15px 0;
    max-height: calc(100vh - 30px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Close button - mai mare pentru vizibilitate */
.qnr-nudge-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #475467;
    color: #475467;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 20;
}

.qnr-nudge-close:hover {
    background: #475467;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.qnr-nudge-close:active {
    transform: scale(0.95);
}

/* Avatar image - MAI MARE pentru vizibilitate de la 3m */
.qnr-nudge-avatar {
	width: auto;
	max-width: 280px;
	height: auto;
	flex-shrink: 0;
	object-fit: contain;
	filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
	/* Scale avatar relative to viewport height to avoid overflow */
	max-height: clamp(120px, 24vh, 220px);
}

.qnr-camera-modal-body{
    margin-top: 30px;
}

.qnr-camera-modal-body h3 {
    margin: 0 0 16px;
    font-size: 24px;
    color: #111827;
}

.qnr-camera-modal-body ul {
    margin: 0 0 20px 20px;
    font-size: 18px;
    line-height: 1.6;
    color: #374151;
    text-align: left;
}

.qnr-camera-modal-body li + li {
    margin-top: 8px;
}

.qnr-camera-modal-example {
    text-align: center;
}

.qnr-camera-modal-example img {
    max-width: 280px;
    width: 100%;
    height: auto;
    /* border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25); */
}

.qnr-camera-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.qnr-camera-modal-footer .qnr-posture-btn {
    min-width: 180px;
}

.qnr-camera-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #475467;
    color: #475467;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.qnr-camera-modal-close:hover {
    background: #475467;
    color: #fff;
}

.qnr-camera-modal-close:active {
    transform: scale(0.95);
}

/* Speech bubble - MAI MARE pentru vizibilitate de la 3m */
.qnr-nudge-bubble {
    position: relative;
    background: #ffffff;
    border-radius: 24px;
	padding: 36px 42px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    max-width: 650px;
	/* Allow bubble to scroll if content would overflow viewport */
	max-height: calc(100% - 8px);
	overflow: auto;
}

/* Speech bubble tail pointing to avatar */
.qnr-nudge-bubble::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 30px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 12px 12px 0;
    border-color: transparent #ffffff transparent transparent;
    filter: drop-shadow(-2px 2px 3px rgba(0, 0, 0, 0.1));
}

/* Nudge text */
/* Text inside bubble - MULT MAI MARE pentru vizibilitate de la 3m */
.qnr-nudge-text {
    margin: 0;
	font-size: 28px;
	line-height: 1.5;
    color: #1d1d1f;
    font-weight: 600;
	/* Responsive text size to fit smaller heights */
	font-size: clamp(18px, 2.3vh + 0.8vw, 28px);
}

/* Animations */
@keyframes qnr-nudge-fadein {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes qnr-nudge-scalein {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Fade out animation */
.qnr-nudge-overlay.qnr-nudge-fadeout,
.qnr-camera-modal.qnr-nudge-fadeout {
    animation: qnr-nudge-fadeout 0.3s ease-in forwards;
}

@keyframes qnr-nudge-fadeout {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Mobile responsive nudge - tot mai mare pentru vizibilitate */
@media (max-width: 768px) {
    .qnr-nudge-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
        padding: 0 20px;
		width: 95%;
		max-height: calc(100vh - 30px);
    }

    .qnr-camera-modal-dialog {
        padding: 24px;
        width: 92vw;
        /* 15px from top and bottom on mobile too */
        margin: 30px 0;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    
    .qnr-nudge-close,
    .qnr-camera-modal-close {
        top: 5px;
        right: 5px;
        width: 42px;
        height: 42px;
        font-size: 32px;
    }
    
    .qnr-nudge-avatar {
		width: auto;
		max-width: 220px;
		max-height: clamp(110px, 22vh, 180px);
    }

    .qnr-camera-modal-example img {
        max-width: 220px;
    }
    
    .qnr-nudge-bubble {
		padding: 28px 32px;
		max-width: 100%;
		max-height: calc(100% - 8px);
		overflow: auto;
    }

    .qnr-camera-modal-body ul {
        font-size: 16px;
    }
    
    /* Adjust bubble tail for mobile */
    .qnr-nudge-bubble::before {
        left: 50%;
        top: -14px;
        transform: translateX(-50%);
        border-width: 0 14px 14px 14px;
        border-color: transparent transparent #ffffff transparent;
    }
    
    .qnr-nudge-text {
		font-size: 22px;
		font-size: clamp(16px, 2vh + 0.6vw, 22px);
    }

    .qnr-camera-modal-body h3 {
        font-size: 20px;
    }

    .qnr-camera-modal-footer {
        flex-direction: column;
    }
    
    .qnr-posture-btn {
        width: 100%;
    }
    
    .qnr-posture-mode {
        /* font-size: 13px; */
        display: none;
    }
    
    .qnr-uploader-layout {
        grid-template-columns: 1fr;
    }
    
    .qnr-divider::before,
    .qnr-divider::after {
        display: none;
    }
    
    /* Keep submit button visible on mobile (override form.css if needed) */
    #qnr-submit-btn.qnr-submit {
        display: inline-flex !important;
        width: 100%;
        margin-top: 20px;
    }

    /* MOBILE: Make camera zone fill screen while respecting container */
    .qnr-camera-panel {
        padding: 0;
        background: transparent;
        border: none;
        margin-bottom: 0;
    }

    .qnr-camera-container {
        gap: 8px;
    }

    #qnr-video-container {
        width: 100%;
        max-width: 100%;
        max-height: 75vh; /* tall enough for full body view */
        border-radius: 12px;
    }
    
    #qnr-video {
        width: 100%;
        height: auto;
        max-height: 75vh;
        object-fit: contain;
        border-radius: 12px;
    }

    #qnr-overlay {
        border-radius: 12px;
    }

    .qnr-live-status {
        font-size: 13px;
        padding: 8px 12px;
        margin: 8px 0;
    }
}

/* Extra small heights: aggressively shrink elements so nudge always fits */
@media (max-height: 600px) {
	.qnr-nudge-content {
		max-height: calc(100vh - 24px);
		gap: 16px;
	}
	.qnr-nudge-avatar {
		max-height: clamp(90px, 20vh, 150px);
	}
	.qnr-nudge-bubble {
		border-radius: 18px;
		padding: 20px 22px;
	}
	.qnr-nudge-text {
		font-size: clamp(15px, 1.8vh + 0.6vw, 20px);
		line-height: 1.35;
	}
}

/* Lock body scroll when modal is open */
body.qnr-modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Force header and footer z-index below modal when modal is open */
body.qnr-modal-open .whb-main-header,
body.qnr-modal-open .qnr-eval-footer,
body.qnr-modal-open header,
body.qnr-modal-open footer,
body.qnr-modal-open [class*="header"],
body.qnr-modal-open [class*="footer"],
body.qnr-modal-open [class*="navigation"],
body.qnr-modal-open [class*="nav-"] {
    z-index: 1 !important;
}
