/* Aim Diagnostic Engine Styles */

:root {
    --aim-bg: #0f172a;
    --aim-panel: rgba(30, 41, 59, 0.7);
    --aim-border: rgba(255, 255, 255, 0.1);
    --aim-accent: #00e5ff;
    --aim-accent-hover: #00b8cc;
    --aim-text: #f8fafc;
    --aim-text-muted: #94a3b8;
    --aim-danger: #ef4444;
    --aim-success: #10b981;
}

body.aim-body {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    color: var(--aim-text);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
.aim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--aim-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-tools {
    display: flex;
    gap: 1rem;
}

/* Main Container */
.aim-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
    position: relative;
}

/* Glass Panels */
.glass-panel {
    background: var(--aim-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--aim-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Setup Screen */
#setup-screen {
    width: 100%;
    max-width: 600px;
    text-align: center;
    box-sizing: border-box;
}

.aim-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.aim-subtitle {
    color: var(--aim-text-muted);
    margin-bottom: 2rem;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--aim-text-muted);
}

.form-group input, .form-group select {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--aim-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--aim-text);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--aim-accent);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.2);
}

.calculated-cm360 {
    background: rgba(0, 229, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    border: 1px dashed var(--aim-accent);
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--aim-danger);
    padding: 1rem;
    border-radius: 4px;
    color: #fca5a5;
    font-size: 0.9rem;
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--aim-accent), #0077ff);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 229, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--aim-text);
    border: 1px solid var(--aim-border);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-ghost {
    background: transparent;
    color: var(--aim-text-muted);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.btn-ghost:hover {
    color: var(--aim-text);
}

.text-danger {
    color: var(--aim-danger);
}

.instruction-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--aim-text-muted);
}

/* Game Canvas */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1000;
    cursor: none;
}

#aim-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem 2rem;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
}

.hud-item {
    display: flex;
    gap: 0.5rem;
}

.text-accent {
    color: var(--aim-accent);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scrollable-modal {
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    max-width: 800px;
}

.data-modal-content {
    width: 90%;
    max-width: 500px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.result-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--aim-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.result-card h3 {
    font-size: 1rem;
    color: var(--aim-text-muted);
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--aim-accent);
}

.score-desc {
    font-size: 0.85rem;
    color: var(--aim-text-muted);
    margin-top: 0.5rem;
}

/* Consultant Area */
.consultant-area {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.consultant-title {
    color: var(--aim-success);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sales-message {
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--aim-accent);
}

.sales-message.danger {
    border-left-color: var(--aim-danger);
}

.recommendation-header {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--aim-text);
}

.recommended-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.product-card {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--aim-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--aim-text);
    transition: transform 0.2s, border-color 0.2s;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: var(--aim-accent);
}

.product-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.product-brand {
    font-size: 0.8rem;
    color: var(--aim-text-muted);
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.data-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Non-Chromium recommendation banner (spec 1.5) */
.browser-banner {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    max-width: 720px;
    margin: 0 auto 1.5rem;
    padding: 0.85rem 1.1rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 8px;
    color: #bfdbfe;
    font-size: 0.9rem;
    line-height: 1.5;
}

.browser-banner i {
    color: var(--aim-accent);
    font-size: 1.1rem;
}

/* ===== AIM-FIT Deep Analysis ===== */
.aimfit-analysis { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); }
.aimfit-top { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 1.5rem; }
.aimfit-overall { display: flex; align-items: flex-start; gap: 1.2rem; background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.3); border-radius: 14px; padding: 1.2rem 1.4rem; }
.aimfit-overall > div:first-child { flex: 1; min-width: 0; }
.aimfit-axes { width: 100%; }
.aimfit-rank { font-size: 3rem; font-weight: 900; line-height: 1; background: linear-gradient(135deg,#a78bfa,#60a5fa); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.aimfit-rank-label { font-size: 0.8rem; color: var(--text-muted, #94a3b8); }
.aimfit-rank-score { font-size: 1.3rem; font-weight: 800; }
.aimfit-axes { display: flex; flex-direction: column; gap: 0.55rem; }
.axis-row { display: flex; align-items: center; gap: 0.8rem; font-size: 0.85rem; }
.axis-name { width: 120px; flex-shrink: 0; color: #cbd5e1; }
.axis-bar { flex: 1; height: 9px; background: rgba(255,255,255,0.07); border-radius: 6px; overflow: hidden; }
.axis-fill { display: block; height: 100%; background: linear-gradient(90deg, #7c3aed, #3b82f6); border-radius: 6px; transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }
.axis-val { width: 32px; text-align: right; font-weight: 700; }
.aimfit-radar-wrap { text-align: center; margin: 1rem 0; }
#aim-radar { max-width: 100%; }
.radar-note { font-size: 0.8rem; color: var(--text-muted, #94a3b8); margin-top: 0.4rem; }
.aimfit-weak { display: flex; flex-direction: column; gap: 0.5rem; }
.weak-item { padding: 0.7rem 0.9rem; border-radius: 8px; font-size: 0.88rem; background: rgba(255,255,255,0.04); border-left: 3px solid #94a3b8; }
.weak-item.sev-high { background: rgba(239,68,68,0.12); border-left-color: #ef4444; color: #fca5a5; }
.weak-item.sev-mid { background: rgba(245,158,11,0.1); border-left-color: #f59e0b; color: #fcd34d; }
.weak-item.sev-none { background: rgba(16,185,129,0.1); border-left-color: #10b981; color: #6ee7b7; }
.aimfit-training { margin: 1rem 0; padding: 0.9rem 1.1rem; border-radius: 10px; background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); font-size: 0.9rem; }
.aimfit-advice { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.advice-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 1rem 1.1rem; }
.advice-card h4 { font-size: 0.95rem; margin-bottom: 0.4rem; color: #c4b5fd; }
.advice-card p { font-size: 0.85rem; color: #cbd5e1; line-height: 1.6; }
@media (max-width: 640px) {
  .aimfit-top { grid-template-columns: 1fr; }
  .aimfit-advice { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .aim-main {
    justify-content: flex-start;
    align-items: stretch;
    padding: 1rem 0.85rem 1.25rem;
  }

  #setup-screen,
  #setup-screen.glass-panel {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 1.35rem 1rem 1.15rem !important;
    border-radius: 18px !important;
  }

  h1.aim-title {
    font-size: 1.48rem !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere;
  }

  .aim-subtitle {
    font-size: 0.78rem !important;
    line-height: 1.55 !important;
    margin-bottom: 0.9rem !important;
  }

  .aim-measures {
    gap: 0.34rem;
    margin-bottom: 1rem !important;
  }

  .aim-measures span {
    max-width: 100%;
    white-space: normal;
    line-height: 1.25;
  }

  .setup-form {
    gap: 0.78rem;
  }

  .form-group input,
  .form-group select {
    min-width: 0;
    font-size: 16px !important;
  }

  #btn-start {
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    line-height: 1.3 !important;
  }
}

/* In-game Raw Input warning (driven by rawInputConfirmed flag, spec 2-C) */
.hud-raw-warning {
    color: #fca5a5 !important;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.15);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border-left: 3px solid var(--aim-danger);
}
