/* ═══════════════════════════════════════════
   ZEUS AI — LAYOUT
   Structural positioning, flexbox, grid
   ═══════════════════════════════════════════ */

/* ── GLOBAL ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

/* ════════════════════════════════════
   MAIN WRAPPER — centered V+H
   ════════════════════════════════════ */
#mainWrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 3rem 1.5rem 4rem;
}
#mainWrapper.has-results {
    align-items: flex-start;
}
#debugAnalyzer {
    width: 100%;
    max-width: 640px;
}

/* ════════════════════════════════════
   CREDITS BADGE (fixed top-right)
   ════════════════════════════════════ */
#creditsBadge {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    cursor: pointer;
}

/* ════════════════════════════════════
   CREDITS POPUP (modal)
   ════════════════════════════════════ */
#creditsOverlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
#creditsOverlay.active {
    opacity: 1;
    pointer-events: auto;
}
#creditsPopup {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    transform: scale(0.88) translateY(24px);
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#creditsOverlay.active #creditsPopup {
    transform: scale(1) translateY(0);
}
.cp-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}
.cp-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    line-height: 1;
}
.cp-cta {
    display: block;
    width: 100%;
    padding: 16px;
    margin-top: 1.5rem;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
}

/* ════════════════════════════════════
   DEBUG ANALYZER — LAYOUT
   ════════════════════════════════════ */
.da-header {
    text-align: center;
    margin-bottom: 2rem;
}
.da-header h1 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}
.da-header p {
    font-size: 0.95rem;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
}
.da-card {
    padding: 2rem;
}
.da-input-group {
    margin-bottom: 1.5rem;
}
.da-input-group input[type="text"] {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    outline: none;
}
.da-modes {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.da-mode {
    flex: 1;
    position: relative;
}
.da-mode input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.da-mode label {
    display: block;
    padding: 16px 20px;
    cursor: pointer;
    text-align: center;
}
.da-mode-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}
.da-mode-detail {
    font-size: 0.78rem;
}
#btnAnalyze {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
}
.da-btn-back {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

/* ── Loading Overlay ── */
.da-loading {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1.5rem;
}
.da-loading.active { display: flex; }
.da-spinner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}
.da-loading-text {
    font-size: 1.1rem;
    text-align: center;
}
.da-progress-bar {
    width: 300px;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}
.da-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.da-progress-msg {
    font-size: 0.9rem;
    text-align: center;
}

/* ════════════════════════════════════
   RESULTS (injected HTML from server)
   ════════════════════════════════════ */
.report-header {
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.report-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}
.report-meta {
    font-size: 0.9rem;
    line-height: 1.8;
}
.section-card {
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.section-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
}
.runtime-errors {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.runtime-error, .runtime-warning {
    padding: 10px 14px;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    word-break: break-word;
}
.ai-analysis { line-height: 1.7; }
.ai-analysis .issue {
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.ai-analysis h4 { font-size: 1rem; margin-bottom: 0.5rem; }
.ai-analysis p { margin-bottom: 0.4rem; font-size: 0.9rem; }
.ai-analysis pre {
    padding: 12px 16px;
    overflow-x: auto;
    margin: 0.5rem 0;
}
.ai-analysis code {
    font-size: 0.82rem;
}
.error-box {
    padding: 1rem 1.25rem;
}
details summary {
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 0;
}

/* ════════════════════════════════════
   ZEUS WIDGET (fixed bottom-left)
   ════════════════════════════════════ */
#zeusWidget {
    position: fixed;
    bottom: 28px;
    left: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
#zeusBubble {
    max-width: 360px;
    margin-bottom: 10px;
    pointer-events: none;
}
#zeusBubble.visible { pointer-events: auto; }
#zeusAvatarWrap {
    width: 110px;
    height: 130px;
    position: relative;
}
#zeusAvatarWrap svg { width: 100%; height: 100%; }
.spk-waves {
    display: none;
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    gap: 2px;
    align-items: flex-end;
}
.spk-waves.on { display: inline-flex; }
#zeusInputWrap {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    width: 360px;
}
#zeusInputWrap.open { display: flex; }
#zeusInput { flex: 1; }
#zeusSend {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#zeusSend svg { width: 18px; height: 18px; }

/* ── Bottom Geo Bar ── */
#zeusGeoBar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 8px 24px;
    z-index: 99998;
}
.geo-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════ */
@media (max-width: 640px) {
    #mainWrapper { padding: 2rem 1rem 4rem; }
    .da-header h1 { font-size: 1.35rem; }
    .da-modes { flex-direction: column; }
    .da-card { padding: 1.25rem; }
    #creditsBadge { top: 10px; right: 10px; padding: 6px 12px; }
}
@media (max-width: 480px) {
    #zeusWidget { bottom: 42px; left: 12px; }
    #zeusBubble { max-width: 280px; }
    #zeusInputWrap { width: 280px; }
    #zeusAvatarWrap { width: 90px; height: 106px; }
    .da-progress-bar { width: 240px; }
}
