/* AR page styles — single source for ar.php (B2)
   Акцент — Pastel (этап 10): тёплый оранжевый; на тёмном фоне камеры —
   bright-вариант (var(--accent-bright) из shared.css). */
:root {
    --ar-danger: #F5B7B0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    width: 100%;
    height: 100%;
    background: #000;
}
/* overflow:hidden only for the AR view; the error page (.ar-page) must stay scrollable */
body.ar-active {
    overflow: hidden;
}

/* Error page (AR unavailable) */
.ar-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    padding: 20px;
}
.ar-error-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 16px;
    padding: 40px 30px;
    max-width: 480px;
    width: 100%;
    text-align: center;
}
.ar-error-card h2 {
    font-size: 22px;
    color: var(--ar-danger);
    margin-bottom: 15px;
}
.ar-error-card p {
    color: #888;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 25px;
}
.ar-error-card .icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Форма PIN (22): тёмная карточка (как .ar-error-card), цифровой ввод.
   Контраст AA: #e0e0e0 на #1a1a2e ≈ 13:1; ошибка #F5B7B0 на #1a1a2e ≈ 7:1 */
.pin-card {
    padding: 40px 26px;
}
.pin-card h2 {
    color: #e0e0e0;
}
.pin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.pin-label {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}
.pin-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 22px;
    letter-spacing: 0.4em;
    text-align: center;
    color: #e0e0e0;
    background: #0f0f1e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    outline: none;
}
.pin-input:focus {
    border-color: var(--accent-bright);
}
.pin-input::placeholder {
    letter-spacing: 0;
    color: #666;
}
.pin-submit {
    width: 100%;
    margin-top: 4px;
}
.pin-error {
    color: var(--ar-danger);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Кнопки AR-страницы (тёмный фон): .btn-база — shared.css, цвета — здесь.
   --primary — bright-акцент (читаемость на тёмном), --secondary — ghost */
.btn--primary {
    background: var(--accent-bright);
    color: var(--text);
    border-color: transparent;
}

.btn--primary:hover {
    filter: brightness(1.05);
}

.btn--secondary {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* AR container */
#container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}
#container video {
    z-index: 1 !important;
}
#container canvas,
#container .css3d-renderer,
#container > iframe {
    z-index: 3 !important;
}

/* Camera error overlay */
#errorOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    color: #e0e0e0;
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}
#errorOverlay h2 { color: var(--ar-danger); margin-bottom: 15px; }
#errorOverlay p { color: #888; font-size: 14px; line-height: 1.6; }

/* Loading overlay */
#loadingOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #0a0a0a;
    color: #e0e0e0;
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid #333;
    border-top-color: var(--accent-bright);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loadingOverlay p {
    margin-top: 15px;
    color: #888;
    font-size: 14px;
}

/* Hint */
#hint {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #aaa;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.5s;
}

/* Status overlay */
#statusOverlay {
    position: fixed;
    left: 12px;
    bottom: 12px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 10px 14px;
    z-index: 110;
    font-size: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #ccc;
    transition: opacity 0.4s;
    pointer-events: none;
    max-width: 280px;
}
#statusOverlay .status-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
#statusOverlay .status-meta {
    color: #666;
    font-size: 11px;
    line-height: 1.4;
}
/* (ar-video-load-progress) прогресс-бар загрузки видео: тонкий, под
   status-line; ширина = percent (StatusUI._setVideoProgress) */
#statusOverlay .video-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}
#statusOverlay .video-progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent-bright);
    border-radius: 2px;
    transition: width 0.3s ease;
}
#statusOverlay .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ABFA7;
    animation: pulse 1.5s ease-in-out infinite;
}
#statusOverlay.state-error .status-dot {
    background: var(--ar-danger);
    animation: none;
}
#statusOverlay.state-tracking .status-dot {
    background: var(--accent-bright);
    animation: none;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
#statusOverlay.state-flash {
    animation: stateFlash 0.4s ease-out;
}
@keyframes stateFlash {
    0% { background: rgba(232, 168, 124, 0.35); }
    100% { background: rgba(0, 0, 0, 0.75); }
}
#statusOverlay.state-error {
    background: rgba(40, 10, 10, 0.85);
}
#statusRetryBtn {
    display: none;
    margin-top: 8px;
    padding: 5px 12px;
    background: rgba(232, 168, 124, 0.3);
    border: 1px solid rgba(232, 168, 124, 0.5);
    border-radius: 6px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    pointer-events: auto;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}
#statusRetryBtn:hover {
    background: rgba(232, 168, 124, 0.5);
}
#soundToggleBtn {
    display: none;
    margin-top: 8px;
    padding: 5px 12px;
    background: rgba(232, 168, 124, 0.3);
    border: 1px solid rgba(232, 168, 124, 0.5);
    border-radius: 6px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    pointer-events: auto;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}
#soundToggleBtn:hover {
    background: rgba(232, 168, 124, 0.5);
}
.tracking-label {
    color: var(--accent-bright);
}

/* Demo overlay */
#demoOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    transition: opacity 0.5s;
    pointer-events: none;
}
#demoOverlay .demo-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.6;
}
#demoOverlay .demo-title {
    font-size: 20px;
    color: #e0e0e0;
    margin-bottom: 10px;
}
#demoOverlay .demo-hint {
    font-size: 14px;
    color: #888;
    line-height: 1.6;
    max-width: 320px;
}

/* Mode toggle button (AR → video) */
.mode-toggle-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 120;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.1s;
}
.mode-toggle-btn:active {
    transform: scale(0.92);
}

/* Service Menu */
.ar-menu-btn {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 120;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.1s;
}
.ar-menu-btn:active {
    transform: scale(0.92);
}
.ar-menu-btn.open {
    background: rgba(232, 168, 124, 0.4);
    border-color: rgba(232, 168, 124, 0.6);
}
.ar-menu {
    position: fixed;
    top: 65px;
    left: 15px;
    z-index: 120;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.ar-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 18px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.ar-menu-item:hover {
    background: rgba(232, 168, 124, 0.2);
    color: #fff;
}
.ar-menu-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 130;
    background: rgba(20, 20, 40, 0.95);
    border: 1px solid rgba(232, 168, 124, 0.4);
    border-radius: 10px;
    padding: 10px 18px;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.ar-debug-panel {
    position: fixed;
    bottom: 60px;
    left: 12px;
    right: 12px;
    z-index: 115;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(232, 168, 124, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: var(--accent-bright);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre;
}
