/* ══════════════════════════════════════════════════════════════════
   Eventify AR  –  Shared stylesheet
   Covers: ArModelViewer, ArModelUpload, ArtikelArTest page
   ══════════════════════════════════════════════════════════════════ */

/* ── model-viewer defaults ──────────────────────────────────────── */
model-viewer {
    display: block;
    --poster-color: #f4f4f8;
}

/* ── ArModelViewer wrapper ──────────────────────────────────────── */
.arv-wrapper {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f4f4f8;
    border: 1px solid #e0e0e8;
}

/* Custom loading bar */
.arv-progress {
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,.1);
}
.arv-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f6ef7, #a855f7);
    transition: width .3s ease;
}

/* Custom AR button */
.arv-ar-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #4f6ef7;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(79,110,247,.35);
    transition: background .2s, transform .15s;
    position: absolute;
    bottom: 16px;
    right: 16px;
}
.arv-ar-button:hover  { background: #3b55d4; transform: translateY(-1px); }
.arv-ar-button:active { transform: translateY(0); }

/* Instructions strip */
.arv-instructions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f0f4ff;
    border-top: 1px solid #d8e0ff;
    color: #3a3f5c;
    font-size: .82rem;
}

/* No-model placeholder */
.arv-no-model {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: #999;
    text-align: center;
}
.arv-no-model p { margin: 0; font-size: .95rem; }

/* iOS-only USDZ state (no GLB uploaded yet) */
.arv-ios-only {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 20px;
    color: #555;
    text-align: center;
}
.arv-ios-only p { margin: 0; font-size: .95rem; }
.arv-ios-hint { font-size: .82rem !important; color: #888; }

/* iOS AR Quick Look trigger button */
.arv-ios-ar-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #4f6ef7;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: .95rem;
    box-shadow: 0 2px 10px rgba(79,110,247,.35);
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.arv-ios-ar-link:hover  { background: #3b55d4; color: #fff; transform: translateY(-1px); }
.arv-ios-ar-link:active { transform: translateY(0); }

/* ── ArModelUpload ──────────────────────────────────────────────── */
.ar-upload-section { margin-top: 24px; }

.ar-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 700px) {
    .ar-upload-grid { grid-template-columns: 1fr; }
}

.ar-upload-block {
    background: #fafafa;
    border: 1px solid #e8e8ee;
    border-radius: 10px;
    padding: 16px;
}

.ar-upload-type-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .92rem;
    font-weight: 600;
    color: #2d2d3a;
    margin: 0 0 12px;
}

.ar-upload-badge {
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .02em;
}
.ar-badge-required { background: #ffe4e4; color: #c00; }
.ar-badge-ios      { background: #e4eeff; color: #2460cc; }

/* Current-file row */
.ar-current-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f0f9f0;
    border: 1px solid #b8e8b8;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: .82rem;
    color: #2a6030;
}
.ar-file-name { flex: 1; word-break: break-all; }

/* File-input / upload row */
.ar-upload-row  { display: flex; flex-direction: column; gap: 8px; }
.ar-file-input-wrapper { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.ar-pick-btn {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    cursor: pointer;
}
.ar-upload-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Animated spinner inside upload button */
.ar-spin-icon {
    flex-shrink: 0;
    animation: artest-spin .7s linear infinite;
}

/* Progress bar shown while upload is running */
.ar-upload-progress {
    height: 4px;
    background: rgba(79,110,247,.15);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}
.ar-upload-progress-inner {
    height: 100%;
    background: linear-gradient(90deg, #4f6ef7, #a855f7, #4f6ef7);
    background-size: 200% 100%;
    animation: ar-progress-slide 1.4s ease-in-out infinite;
}
@keyframes ar-progress-slide {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Message feedback */
.ar-msg-success {
    margin: 8px 0 0;
    padding: 8px 12px;
    background: #f0fff0;
    border: 1px solid #9be09b;
    border-radius: 6px;
    color: #1a6b1a;
    font-size: .85rem;
}
.ar-msg-error {
    margin: 8px 0 0;
    padding: 8px 12px;
    background: #fff0f0;
    border: 1px solid #f0a0a0;
    border-radius: 6px;
    color: #8b0000;
    font-size: .85rem;
}

/* Danger button */
.ar-btn-danger {
    background: #fff0f0;
    color: #c00;
    border: 1px solid #f0b0b0;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: .8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background .15s;
}
.ar-btn-danger:hover { background: #ffe0e0; }
.ar-btn-sm { padding: 3px 8px; font-size: .75rem; }

/* Hint bar */
.ar-upload-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin-top: 12px;
    background: #f7f7fb;
    border: 1px solid #e4e4ef;
    border-radius: 8px;
    font-size: .8rem;
    color: #555;
}
.ar-upload-hint code {
    background: #eee;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .8rem;
}

/* Test-link bar */
.ar-test-link-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    margin-top: 8px;
    background: #f0f4ff;
    border: 1px solid #d0daff;
    border-radius: 8px;
    font-size: .8rem;
    color: #3a4a8a;
}
.ar-test-link-bar a {
    color: #3b55d4;
    font-weight: 600;
    word-break: break-all;
    text-decoration: none;
}
.ar-test-link-bar a:hover { text-decoration: underline; }

/* ── Scan 3D – trigger button in ArtikelAdminEdit ───────────────── */
.ar-scan-hint {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.ar-scan-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: #fff;
    color: #4f6ef7;
    border: 1.5px solid #4f6ef7;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.ar-scan-btn:hover { background: #f0f3ff; }

/* ── Scan3DDialog ───────────────────────────────────────────────── */

/* Full-screen dimmed overlay */
.scan3d-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 12px;
}

/* Dialog box */
.scan3d-dialog {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .35);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.scan3d-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.scan3d-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.05rem;
    color: #1a1a2e;
}
.scan3d-close-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.scan3d-close-btn:hover:not(:disabled) { background: #f0f0f0; color: #333; }
.scan3d-close-btn:disabled             { opacity: .4; cursor: default; }

/* Camera area */
.scan3d-camera-wrap {
    position: relative;
    background: #0d0d0d;
    flex-shrink: 0;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.scan3d-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scan3d-hidden { display: none; }

.scan3d-camera-loading,
.scan3d-camera-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #ccc;
    font-size: .9rem;
    text-align: center;
    padding: 20px;
}
.scan3d-camera-error { color: #ff8a8a; }

/* Photo count badge (overlay on camera) */
.scan3d-photo-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    pointer-events: none;
}

/* Thumbnail strip */
.scan3d-thumbs {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f0f0;
}
.scan3d-thumb-item {
    position: relative;
    flex-shrink: 0;
}
.scan3d-thumb-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e0e0e8;
    display: block;
}
.scan3d-thumb-del {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #c00;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: .7rem;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scan3d-thumb-del:hover { background: #a00; }

/* Status message */
.scan3d-status {
    margin: 8px 16px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: .85rem;
    flex-shrink: 0;
}
.scan3d-status-ok    { background: #f0fff0; border: 1px solid #9be09b; color: #1a6b1a; }
.scan3d-status-error { background: #fff0f0; border: 1px solid #f0a0a0; color: #8b0000; }

/* Action row */
.scan3d-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.scan3d-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
    white-space: nowrap;
}
.scan3d-btn:disabled { opacity: .45; cursor: default; transform: none; }

.scan3d-btn-capture {
    background: #f0f4ff;
    color: #3a4ab0;
    border: 1.5px solid #c0ccff;
}
.scan3d-btn-capture:hover:not(:disabled) { background: #dce4ff; }

.scan3d-btn-process {
    background: #4f6ef7;
    color: #fff;
    flex: 1;
    justify-content: center;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(79,110,247,.3);
}
.scan3d-btn-process:hover:not(:disabled) { background: #3b55d4; }

.scan3d-btn-cancel {
    background: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
}
.scan3d-btn-cancel:hover:not(:disabled) { background: #eee; }

/* Hint text */
.scan3d-hint-text {
    margin: 0;
    padding: 0 16px 14px;
    font-size: .78rem;
    color: #888;
    flex-shrink: 0;
}

/* Section label row (badge + title + time hint) */
.scan3d-section {
    border-bottom: 1px solid #f0f0f5;
    padding-bottom: 4px;
}
.scan3d-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 6px;
    flex-wrap: wrap;
}
.scan3d-time-hint {
    margin-left: auto;
    font-size: .75rem;
    color: #888;
    white-space: nowrap;
}

/* Aim hint overlay on camera */
.scan3d-aim-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.5);
    color: #fff;
    font-size: .78rem;
    padding: 4px 12px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}

/* Thumbnail primary label */
.scan3d-thumb-primary { border-color: #4f6ef7 !important; }
.scan3d-thumb-label {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    background: rgba(79,110,247,.85);
    color: #fff;
    font-size: .6rem;
    text-align: center;
    border-radius: 0 0 4px 4px;
    padding: 1px 0;
    pointer-events: none;
}

/* Progress bar (determinate) */
.scan3d-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px 0;
    flex-shrink: 0;
}
.scan3d-progress-bar-bg {
    flex: 1;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}
.scan3d-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f6ef7, #a855f7);
    border-radius: 4px;
    transition: width .4s ease;
    min-width: 4px;
}
.scan3d-progress-pct {
    font-size: .8rem;
    font-weight: 600;
    color: #4f6ef7;
    min-width: 36px;
    text-align: right;
}

/* Badge variants */
.scan3d-badge {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: .03em;
    flex-shrink: 0;
}
.scan3d-badge-ai     { background: #e8eeff; color: #3040b0; }
.scan3d-badge-manual { background: #e8f8e8; color: #276027; }

/* Manual / alternative section (collapsible) */
.scan3d-manual-section {
    border-top: 1px solid #f0f0f5;
}
.scan3d-manual-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    list-style: none;
    font-size: .88rem;
    user-select: none;
    color: #444;
    flex-wrap: wrap;
}
.scan3d-manual-summary::-webkit-details-marker { display: none; }
.scan3d-manual-summary::before {
    content: "▶";
    font-size: .65rem;
    color: #aaa;
    transition: transform .2s;
}
.scan3d-manual-section[open] .scan3d-manual-summary::before {
    transform: rotate(90deg);
}
.scan3d-manual-summary small { color: #888; margin-left: auto; }

.scan3d-manual-body {
    padding: 0 16px 16px;
}
.scan3d-manual-intro {
    font-size: .82rem;
    color: #555;
    margin: 0 0 10px;
}
.scan3d-app-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.scan3d-app-item {
    background: #f7f8ff;
    border: 1px solid #e4e4ef;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.scan3d-app-item strong { font-size: .88rem; color: #1a1a2e; }
.scan3d-app-item span  { font-size: .8rem;  color: #555; }
.scan3d-app-item small { font-size: .75rem; color: #888; }
.scan3d-app-item code  { background: #eee; padding: 0 4px; border-radius: 3px; font-size: .75rem; }

.scan3d-manual-steps {
    margin: 0;
    padding-left: 20px;
    font-size: .82rem;
    color: #444;
}
.scan3d-manual-steps li { margin-bottom: 4px; }

/* ── ArtikelArTest page ─────────────────────────────────────────── */
.artest-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

/* Loading */
.artest-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 300px;
    color: #666;
}
.artest-spinner {
    width: 40px; height: 40px;
    border: 4px solid #e0e0e8;
    border-top-color: #4f6ef7;
    border-radius: 50%;
    animation: artest-spin .8s linear infinite;
}
@keyframes artest-spin { to { transform: rotate(360deg); } }

/* Not found */
.artest-not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 300px;
    text-align: center;
    color: #666;
}

/* Header */
.artest-header {
    background: #fff;
    border: 1px solid #e8e8ee;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.artest-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
.artest-thumb {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e0e0e8;
    flex-shrink: 0;
}
.artest-badge {
    display: inline-block;
    background: #fff0e0;
    color: #9a5a00;
    border: 1px solid #ffd090;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    margin-bottom: 6px;
}
.artest-title { margin: 0 0 4px; font-size: 1.4rem; color: #1a1a2e; }
.artest-meta  { margin: 0; font-size: .82rem; color: #888; }

/* Viewer container */
.artest-viewer-container {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* AR info grid */
.artest-ar-info {
    background: #fff;
    border: 1px solid #e8e8ee;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.artest-ar-info-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 600px) {
    .artest-ar-info-row { grid-template-columns: 1fr; }
}
.artest-ar-platform {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #f7f8ff;
    border-radius: 8px;
}
.artest-platform-icon { font-size: 1.4rem; line-height: 1; }
.artest-ar-platform strong { display: block; font-size: .88rem; color: #1a1a2e; }
.artest-ar-platform small  { color: #666; font-size: .78rem; line-height: 1.4; }

/* AR instructions */
.artest-instructions { margin-top: 4px; }
.artest-instructions h3 { font-size: 1rem; color: #1a1a2e; margin: 0 0 10px; }
.artest-instructions ol { margin: 0; padding-left: 20px; color: #444; font-size: .9rem; }
.artest-instructions li { margin-bottom: 6px; }

/* No model */
.artest-no-model {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    background: #fff;
    border: 2px dashed #d0d0e0;
    border-radius: 12px;
    text-align: center;
    color: #888;
    margin-bottom: 20px;
}
.artest-no-model h2 { color: #444; margin: 0; }
.artest-no-model p  { margin: 0; max-width: 400px; font-size: .9rem; }

/* Back / admin link */
.artest-back-link {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 18px;
    background: #4f6ef7;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: .88rem;
}
.artest-back-link:hover { background: #3b55d4; color: #fff; }

/* Debug accordion */
.artest-debug {
    margin-top: 16px;
    background: #fff;
    border: 1px solid #e0e0e8;
    border-radius: 10px;
    overflow: hidden;
    font-size: .85rem;
}
.artest-debug summary {
    padding: 12px 16px;
    cursor: pointer;
    color: #555;
    font-weight: 500;
    user-select: none;
    list-style: none;
}
.artest-debug summary::before { content: "▶ "; }
.artest-debug[open] summary::before { content: "▼ "; }
.artest-debug-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.artest-debug-table th,
.artest-debug-table td {
    padding: 8px 16px;
    text-align: left;
    border-top: 1px solid #eee;
}
.artest-debug-table th {
    width: 140px;
    color: #666;
    font-weight: 500;
    background: #fafafa;
}
.artest-debug-table td { word-break: break-all; }

/* Footer note */
.artest-footer-note {
    margin-top: 20px;
    padding: 12px 16px;
    background: #fff8e8;
    border: 1px solid #ffd89a;
    border-radius: 8px;
    font-size: .8rem;
    color: #8a5d00;
    text-align: center;
}
