/* ============================================
   UTP AR Explorer — PWA App Styles
   ============================================ */

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --primary-dark: #0d1642;
    --accent: #a78bfa;
    --accent2: #ff6f00;
    --bg-dark: #0d0d2b;
    --bg-card: #1a1a3e;
    --bg-surface: #12122e;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: rgba(255,255,255,0.08);
    --radius: 14px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

body {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    user-select: none;
    -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ============ SPLASH ============ */
.splash {
    position: fixed; inset: 0; z-index: 9999;
    background: linear-gradient(180deg, #0d0d2b 0%, #1a1a4e 50%, #2d1b69 100%);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s ease;
}
.splash.fade-out { opacity: 0; pointer-events: none; }
.splash-content { text-align: center; }
.splash-logo {
    width: 100px; height: 100px; margin: 0 auto 20px;
    background: rgba(255,255,255,0.1); border-radius: 28px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.8rem; color: var(--accent);
    animation: pulseGlow 2s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(167,139,250,0.3); }
    50% { box-shadow: 0 0 40px rgba(167,139,250,0.6); }
}
.splash-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; color: #fff; }
.splash-sub { font-size: 0.9rem; color: var(--accent); margin-bottom: 30px; }
.splash-loader { width: 200px; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin: 0 auto; overflow: hidden; }
.splash-bar {
    width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), #c084fc);
    border-radius: 2px; animation: loadBar 2.5s ease-in-out forwards;
}
@keyframes loadBar { to { width: 100%; } }
.splash-version { font-size: 0.75rem; color: var(--text-muted); margin-top: 24px; }

/* ============ APP SHELL ============ */
.app-shell {
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    background: var(--bg-dark);
}

/* STATUS BAR */
.status-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 16px; padding-top: calc(4px + var(--safe-top));
    background: var(--primary-dark); font-size: 0.72rem; color: var(--text-muted);
    min-height: 24px;
}
.status-icons { display: flex; gap: 8px; font-size: 0.65rem; }

/* HEADER */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--primary-dark);
    border-bottom: 1px solid var(--border);
}
.app-header h2 { font-size: 1.05rem; font-weight: 600; flex: 1; text-align: center; }
.header-btn {
    background: none; border: none; color: var(--text); font-size: 1.1rem;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer;
}
.header-btn:active { background: rgba(255,255,255,0.1); }

/* SCREENS */
.screens { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.screen { display: none; min-height: 100%; }
.screen.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.pad-screen { padding: 20px 16px 100px; }

.screen-section-title {
    font-size: 1.15rem; font-weight: 700; margin-bottom: 4px;
    display: flex; align-items: center; gap: 8px;
}
.screen-section-title i { color: var(--accent); }
.screen-section-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }

/* ============ HOME ============ */
.home-hero {
    position: relative; padding: 40px 20px 30px; text-align: center;
    overflow: hidden;
}
.home-hero-bg {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, #1a1a4e, #0d0d2b);
}
.home-hero-content { position: relative; z-index: 1; }
.home-avatar {
    width: 80px; height: 80px; margin: 0 auto 16px;
    background: rgba(167,139,250,0.15); border-radius: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; color: var(--accent);
    border: 2px solid rgba(167,139,250,0.3);
}
.home-hero h2 { font-size: 1.3rem; margin-bottom: 6px; }
.home-hero p { font-size: 0.88rem; color: var(--text-muted); }

.home-actions { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.action-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    cursor: pointer; width: 100%; text-align: left;
    color: var(--text); transition: all 0.2s;
}
.action-card:active { transform: scale(0.98); background: rgba(255,255,255,0.05); }
.action-card.primary { background: linear-gradient(135deg, var(--primary), #2d1b69); border-color: rgba(167,139,250,0.3); }
.action-icon {
    width: 46px; height: 46px; border-radius: 12px;
    background: rgba(167,139,250,0.15); display: flex;
    align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--accent); flex-shrink: 0;
}
.action-card.primary .action-icon { background: rgba(255,255,255,0.15); color: #fff; }
.action-text h3 { font-size: 0.95rem; font-weight: 600; }
.action-text p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.action-card > .fa-chevron-right { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }

.home-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    padding: 12px 16px 24px;
}
.stat {
    background: var(--bg-card); border-radius: 10px; padding: 12px 8px;
    text-align: center; border: 1px solid var(--border);
}
.stat-num { display: block; font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.stat-lbl { display: block; font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

/* ============ AR CAMERA ============ */
.ar-view { height: calc(100vh - 140px); position: relative; }
.ar-camera-feed {
    width: 100%; height: 100%; background: #000;
    position: relative; overflow: hidden;
}
.ar-camera-feed video {
    width: 100%; height: 100%; object-fit: cover;
}
.ar-overlay {
    position: absolute; inset: 0; pointer-events: none;
}
.ar-corners { position: absolute; inset: 40px; }
.corner {
    position: absolute; width: 40px; height: 40px;
    border-color: var(--accent); border-style: solid;
}
.corner.tl { top:0; left:0; border-width: 3px 0 0 3px; border-radius: 8px 0 0 0; }
.corner.tr { top:0; right:0; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.corner.bl { bottom:0; left:0; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.corner.br { bottom:0; right:0; border-width: 0 3px 3px 0; border-radius: 0 0 8px 0; }

.ar-scan-line {
    position: absolute; left: 40px; right: 40px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    top: 40px; animation: scanLine 3s ease-in-out infinite;
}
@keyframes scanLine {
    0%, 100% { top: 40px; opacity: 0.3; }
    50% { top: calc(100% - 42px); opacity: 1; }
}

.ar-hud { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; }
.ar-hud-top { display: flex; justify-content: space-between; }
.ar-badge {
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    padding: 6px 12px; border-radius: 20px; font-size: 0.75rem;
    display: flex; align-items: center; gap: 6px;
}
.recording { color: #ef4444; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

.ar-hud-bottom { display: flex; justify-content: center; gap: 20px; padding-bottom: 20px; }
.ar-btn {
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.3); color: #fff;
    font-size: 1.3rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
}
.ar-btn:active { background: rgba(255,255,255,0.3); }
.ar-btn.secondary { width: 46px; height: 46px; font-size: 1rem; margin-top: 7px; }

.ar-no-camera {
    position: absolute; inset: 0; display: none;
    flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-muted); text-align: center; padding: 20px;
}

.btn-pill {
    padding: 10px 24px; border-radius: 50px;
    background: var(--accent); color: #fff; border: none;
    font-weight: 600; font-size: 0.9rem; cursor: pointer;
}

/* ============ CATALOGO ============ */
.model-grid { display: flex; flex-direction: column; gap: 10px; }
.model-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px;
    cursor: pointer; transition: all 0.2s;
}
.model-card:active { transform: scale(0.98); }
.model-thumb {
    width: 54px; height: 54px; border-radius: 14px;
    background: linear-gradient(135deg, rgba(167,139,250,0.2), rgba(167,139,250,0.05));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--accent); flex-shrink: 0;
}
.model-info h4 { font-size: 0.95rem; font-weight: 600; }
.model-info p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.model-badge {
    display: inline-block; margin-top: 4px; padding: 2px 10px;
    background: rgba(167,139,250,0.15); border-radius: 20px;
    font-size: 0.7rem; color: var(--accent); font-weight: 600;
}

/* ============ VIEWER ============ */
.viewer-container { height: calc(100vh - 140px); display: flex; flex-direction: column; }
.viewer-container model-viewer { flex: 1; background: var(--bg-surface); }
.ar-launch-btn {
    background: var(--accent); color: #fff; border: none;
    padding: 10px 20px; border-radius: 50px; font-weight: 600;
    font-size: 0.85rem; cursor: pointer; display: flex;
    align-items: center; gap: 6px;
}
.viewer-info {
    background: var(--bg-card); padding: 16px;
    border-top: 1px solid var(--border);
}
.viewer-info h3 { font-size: 1rem; margin-bottom: 4px; }
.viewer-info p { font-size: 0.82rem; color: var(--text-muted); }
.viewer-controls { display: flex; gap: 8px; margin-top: 12px; }
.ctrl-btn {
    flex: 1; padding: 8px; border-radius: 8px;
    background: rgba(255,255,255,0.08); border: 1px solid var(--border);
    color: var(--text); font-size: 0.78rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 4px;
}
.ctrl-btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctrl-btn:active { opacity: 0.7; }
.viewer-gestures {
    display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap;
}
.viewer-gestures span {
    font-size: 0.72rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
}

/* ============ MULTIMEDIA ============ */
.media-section {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 16px; margin-bottom: 14px;
    border: 1px solid var(--border);
}
.media-section h4 {
    font-size: 0.92rem; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.media-section h4 i { color: var(--accent); }

.video-wrapper video {
    width: 100%; border-radius: 10px;
    background: #000;
}
.media-meta {
    display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap;
}
.media-meta span {
    font-size: 0.72rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.05); padding: 3px 10px;
    border-radius: 20px;
}

.audio-player audio { width: 100%; margin-top: 8px; }
.audio-visual { margin-bottom: 8px; }
.audio-bars {
    display: flex; align-items: flex-end; gap: 3px;
    height: 40px; padding: 4px 0;
}
.audio-bars span {
    flex: 1; background: linear-gradient(180deg, var(--accent), rgba(167,139,250,0.3));
    border-radius: 2px; animation: audioBar 1.2s ease-in-out infinite;
}
.audio-bars span:nth-child(1) { animation-delay: 0s; height: 60%; }
.audio-bars span:nth-child(2) { animation-delay: 0.1s; height: 80%; }
.audio-bars span:nth-child(3) { animation-delay: 0.2s; height: 40%; }
.audio-bars span:nth-child(4) { animation-delay: 0.15s; height: 90%; }
.audio-bars span:nth-child(5) { animation-delay: 0.3s; height: 50%; }
.audio-bars span:nth-child(6) { animation-delay: 0.05s; height: 70%; }
.audio-bars span:nth-child(7) { animation-delay: 0.25s; height: 45%; }
.audio-bars span:nth-child(8) { animation-delay: 0.1s; height: 85%; }
.audio-bars span:nth-child(9) { animation-delay: 0.35s; height: 55%; }
.audio-bars span:nth-child(10) { animation-delay: 0.2s; height: 75%; }
.audio-bars span:nth-child(11) { animation-delay: 0.15s; height: 35%; }
.audio-bars span:nth-child(12) { animation-delay: 0.3s; height: 65%; }
.audio-bars span:nth-child(13) { animation-delay: 0.05s; height: 50%; }
.audio-bars span:nth-child(14) { animation-delay: 0.25s; height: 80%; }
.audio-bars span:nth-child(15) { animation-delay: 0.1s; height: 45%; }
@keyframes audioBar {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

.image-gallery {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.gallery-item {
    text-align: center; cursor: pointer;
}
.gallery-thumb {
    width: 100%; aspect-ratio: 1; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s;
}
.gallery-item:active .gallery-thumb { transform: scale(0.95); }
.gallery-item span { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }

.media-table {
    width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.media-table th, .media-table td {
    padding: 8px 10px; text-align: left;
    border-bottom: 1px solid var(--border);
}
.media-table th { color: var(--accent); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; }
.media-table td { color: var(--text-muted); }

/* ============ REPORTE ============ */
.report-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 18px; margin-bottom: 14px;
    border: 1px solid var(--border);
}
.report-card h4 {
    font-size: 0.95rem; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.report-card h4 i { color: var(--accent); }
.report-card.highlight {
    background: linear-gradient(135deg, rgba(167,139,250,0.1), rgba(167,139,250,0.02));
    border-color: rgba(167,139,250,0.3);
}

/* Architecture diagram */
.arch-diagram { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.arch-layer { width: 100%; }
.arch-box {
    padding: 14px; border-radius: 10px; text-align: center;
}
.arch-box strong { display: block; font-size: 0.88rem; margin-bottom: 6px; }
.arch-box span { display: block; font-size: 0.75rem; color: var(--text-muted); line-height: 1.6; }
.arch-box.client { background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.05)); border: 1px solid rgba(99,102,241,0.2); }
.arch-box.ar { background: linear-gradient(135deg, rgba(167,139,250,0.2), rgba(167,139,250,0.05)); border: 1px solid rgba(167,139,250,0.2); }
.arch-box.assets { background: linear-gradient(135deg, rgba(244,114,182,0.2), rgba(244,114,182,0.05)); border: 1px solid rgba(244,114,182,0.2); }
.arch-arrow { color: var(--text-muted); font-size: 0.9rem; padding: 2px 0; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: ''; position: absolute; left: 14px; top: 8px; bottom: 8px;
    width: 2px; background: var(--border);
}
.tl-item { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; position: relative; }
.tl-num {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent); color: #fff; display: flex;
    align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
    position: relative; z-index: 1;
}
.tl-content strong { font-size: 0.88rem; }
.tl-content p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Deploy cards */
.deploy-methods { display: flex; flex-direction: column; gap: 10px; }
.deploy-card {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; position: relative;
}
.deploy-card.active { border-color: var(--accent); background: rgba(167,139,250,0.05); }
.deploy-icon { font-size: 1.5rem; color: var(--accent); margin-bottom: 8px; }
.deploy-card h5 { font-size: 0.9rem; margin-bottom: 8px; }
.deploy-card ul { list-style: none; }
.deploy-card li {
    font-size: 0.78rem; color: var(--text-muted); padding: 3px 0;
    padding-left: 16px; position: relative;
}
.deploy-card li::before {
    content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; left: 0; color: var(--accent); font-size: 0.65rem;
}
.deploy-active-badge {
    position: absolute; top: 12px; right: 12px;
    background: var(--accent); color: #fff; font-size: 0.68rem;
    padding: 3px 10px; border-radius: 20px; font-weight: 600;
}

/* Install steps */
.install-steps { list-style: none; counter-reset: step; }
.install-steps li {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.install-steps li:last-child { border-bottom: none; }
.install-steps li i { color: var(--accent); width: 20px; text-align: center; font-size: 1rem; }

/* ============ ABOUT ============ */
.about-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 30px 20px; text-align: center;
    border: 1px solid var(--border);
}
.about-logo {
    width: 80px; height: 80px; margin: 0 auto 16px;
    background: linear-gradient(135deg, #1a1a4e, #2d1b69);
    border-radius: 22px; display: flex; align-items: center;
    justify-content: center; font-size: 2.2rem; color: var(--accent);
    border: 2px solid rgba(167,139,250,0.3);
}
.about-card h3 { font-size: 1.2rem; }
.about-version { font-size: 0.8rem; color: var(--accent); margin-top: 4px; }
.about-desc { font-size: 0.85rem; color: var(--text-muted); margin: 16px 0; line-height: 1.5; }
.about-card hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.about-info { text-align: left; }
.about-row {
    display: flex; justify-content: space-between; padding: 8px 0;
    border-bottom: 1px solid var(--border); font-size: 0.82rem;
}
.about-row span { color: var(--text-muted); }
.about-row strong { color: var(--text); font-weight: 500; text-align: right; max-width: 60%; }
.about-copy { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

/* ============ HELP ============ */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; cursor: pointer;
}
.faq-q {
    padding: 14px 16px; font-size: 0.9rem; font-weight: 600;
    display: flex; align-items: center; gap: 10px;
}
.faq-q i { color: var(--accent); font-size: 0.7rem; transition: transform 0.2s; }
.faq-item.open .faq-q i { transform: rotate(90deg); }
.faq-a {
    padding: 0 16px; max-height: 0; overflow: hidden;
    font-size: 0.82rem; color: var(--text-muted); line-height: 1.5;
    transition: all 0.3s ease;
}
.faq-item.open .faq-a { padding: 0 16px 14px; max-height: 200px; }

.help-contact {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 20px; margin-top: 20px; text-align: center;
    border: 1px solid var(--border);
}
.help-contact h4 { margin-bottom: 8px; font-size: 0.95rem; }
.help-contact p { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.help-contact i { color: var(--accent); }

/* ============ SETTINGS ============ */
.settings-list { display: flex; flex-direction: column; }
.setting-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s;
}
.setting-item:active { background: rgba(255,255,255,0.03); }
.setting-item i { color: var(--accent); width: 20px; text-align: center; }
.setting-item span { flex: 1; font-size: 0.92rem; }
.setting-item .r { color: var(--text-muted); font-size: 0.75rem; }

/* ============ BOTTOM NAV ============ */
.bottom-nav {
    display: flex; background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom); min-height: 60px;
}
.nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    background: none; border: none; color: var(--text-muted);
    font-size: 0.65rem; cursor: pointer; padding: 8px 4px;
    transition: color 0.2s;
}
.nav-item i { font-size: 1.1rem; }
.nav-item.active { color: var(--accent); }
.nav-item:active { opacity: 0.7; }

/* ============ TOAST ============ */
.app-toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: #fff; padding: 10px 24px;
    border-radius: 50px; font-size: 0.82rem; z-index: 999;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.app-toast.show { opacity: 1; }

/* ============ RESPONSIVE ============ */
@media (min-width: 600px) {
    .app-shell { max-width: 420px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
    .image-gallery { grid-template-columns: repeat(5, 1fr); }
}
