/* ==========================================================================
   ELITE AI MISTAKE DETECTOR CSS
   Glassmorphism, Red/Warning emphasis, Drawers
   ========================================================================== */

/* Layout & Globals */
.aim-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; position: relative; overflow-x: hidden; }

/* Utilities */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.hidden-mobile { display: flex; }
@media (max-width: 768px) { .hidden-mobile { display: none !important; } }
.m-0 { margin: 0; } .mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.p-0 { padding: 0 !important; } .p-16 { padding: 16px; } .p-24 { padding: 24px; } .pt-16 { padding-top: 16px; } .pt-24 { padding-top: 24px; } .pb-16 { padding-bottom: 16px; } .border-top { border-top: 1px solid rgba(255,255,255,0.1); } .border-bottom { border-bottom: 1px solid rgba(255,255,255,0.1); }
.text-xs { font-size: 0.75rem; } .text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; }
.uppercase { text-transform: uppercase; } .letter-spacing { letter-spacing: 1px; } .font-bold { font-weight: 700; } .tabular-nums { font-variant-numeric: tabular-nums; }
.flex-between { display: flex; justify-content: space-between; align-items: center; } .flex-align-center { display: flex; align-items: center; } .align-start { align-items: flex-start; } .align-end { align-items: flex-end; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex-grow { flex-grow: 1; min-height: 0; } .flex-shrink-0 { flex-shrink: 0; } .cursor-pointer { cursor: pointer; }

/* Palette */
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-orange { color: #f97316; } .text-white { color: #ffffff; }
.bg-purple { background: #c084fc; color: #000; } .bg-cyan { background: #06b6d4; color: #000; } .bg-gold { background: #fbbf24; color: #000; } .bg-green { background: #22c55e; color: #000; } .bg-red { background: #ef5350; color: #fff; } .bg-dark { background: rgba(0,0,0,0.5); }
.border-cyan { border: 1px solid rgba(6,182,212,0.4); } .border-green { border: 1px solid rgba(34,197,94,0.4); } .border-purple { border: 1px solid rgba(192,132,252,0.4); } .border-red { border: 1px solid rgba(239,83,80,0.4); } .border-orange { border: 1px solid rgba(249,115,22,0.4); } .border-gold { border: 1px solid rgba(251,191,36,0.4); }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(168,85,247,0.4); } 70% { box-shadow: 0 0 0 15px rgba(168,85,247,0); } 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); } }
@keyframes pulseGlowRed { 0% { box-shadow: 0 0 0 0 rgba(239,83,80,0.4); } 70% { box-shadow: 0 0 0 15px rgba(239,83,80,0); } 100% { box-shadow: 0 0 0 0 rgba(239,83,80,0); } }
@keyframes spinSlow { 100% { transform: rotate(360deg); } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseGlow 2s infinite; border-radius: 12px; }
.pulse-glow { animation: pulseGlow 3s infinite; border-radius: 50%; }
.spinning-slow { animation: spinSlow 3s linear infinite; }

/* Cards & Buttons */
.aim-card { background: rgba(255,255,255,0.03); backdrop-filter: blur(24px) saturate(180%); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; padding: 24px; box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05); transition: all 0.4s; }

.aim-btn { padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; border: none; text-transform: uppercase; font-family: inherit; }
.aim-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.aim-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.aim-btn--primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.aim-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.aim-btn--secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.aim-btn-icon { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.aim-btn-icon:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; transform: scale(1.05); }

.aim-input, .aim-select { width: 100%; padding: 10px 14px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; font-family: inherit; font-size: 0.85rem; outline: none; }
.aim-input:focus, .aim-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.aim-form-group { margin-bottom: 16px; }
.aim-form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); font-weight: 600; }
.aim-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Switch Toggle */
.aim-switch { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.aim-switch input { opacity: 0; width: 0; height: 0; }
.aim-slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 24px; }
.aim-slider-toggle:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.aim-switch input:checked + .aim-slider-toggle { background-color: #a855f7; }
.aim-switch input:checked + .aim-slider-toggle:before { transform: translateX(20px); }

/* Header & Status Strip */
.aim-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; flex-shrink: 0; }
.aim-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.aim-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }

/* Stats Dashboard */
.aim-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.aim-stat-card { display: flex; flex-direction: column; padding: 20px; border-radius: 16px; }
.aim-stat-card h2 { font-size: 2.5rem; font-weight: 800; tabular-nums: tabular-nums; line-height: 1; }

/* Filters */
.aim-filters { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; background: rgba(255,255,255,0.03); padding: 12px 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.aim-filter-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.aim-pill { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.6); padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; cursor: pointer; transition: 0.3s; white-space: nowrap; font-weight: 600; text-transform: uppercase; }
.aim-pill:hover { color: white; background: rgba(255,255,255,0.05); }
.aim-pill.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: rgba(192,132,252,0.4); }
.aim-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.2); margin: 0 4px; }

.aim-search-box { position: relative; min-width: 200px; }
.aim-search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.4); }
.aim-search-box input { width: 100%; padding: 8px 14px 8px 36px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; outline: none; font-size: 0.8rem; }
.aim-search-box input:focus { border-color: #c084fc; }

/* Mistakes List */
.aim-list { display: flex; flex-direction: column; gap: 16px; }
.aim-mistake-card { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; display: flex; cursor: pointer; transition: 0.3s; position: relative; overflow: hidden; }
.aim-mistake-card:hover { transform: translateY(-2px); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }

.aim-mistake-card.sev-critical { border-color: rgba(239,83,80,0.4); }
.aim-mistake-card.sev-critical:hover { border-color: #ef5350; box-shadow: 0 10px 30px rgba(239,83,80,0.2); }

.m-stripe { width: 6px; flex-shrink: 0; }
.stripe-cri { background: #ef5350; }
.stripe-maj { background: #f97316; }
.stripe-mod { background: #fbbf24; }
.stripe-min { background: #06b6d4; }

.m-content { padding: 16px 20px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; }
.m-title { font-size: 1.1rem; font-weight: 800; margin: 0 0 8px 0; color: #fff; }

.aim-badge { font-size: 0.65rem; padding: 4px 8px; border-radius: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; display: inline-flex; align-items: center; gap: 4px; }
.aim-severity-badge { font-size: 0.65rem; padding: 4px 8px; border-radius: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }
.sev-critical { color: #ef5350; border-color: #ef5350; background: rgba(239,83,80,0.1); }
.sev-major { color: #f97316; border-color: #f97316; background: rgba(249,115,22,0.1); }
.sev-moderate { color: #fbbf24; border-color: #fbbf24; background: rgba(251,191,36,0.1); }
.sev-minor { color: #06b6d4; border-color: #06b6d4; background: rgba(6,182,212,0.1); }

.m-desc { font-size: 0.85rem; color: rgba(255,255,255,0.7); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-evidence { font-size: 0.75rem; color: rgba(255,255,255,0.5); display: flex; gap: 16px; align-items: center; }

.m-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 12px; }
.aim-status-pill { font-size: 0.7rem; font-weight: 800; padding: 4px 10px; border-radius: 12px; text-transform: uppercase; letter-spacing: 1px; }
.st-new { background: rgba(239,83,80,0.2); color: #ef5350; border: 1px solid rgba(239,83,80,0.4); }
.st-ack { background: rgba(251,191,36,0.2); color: #fbbf24; border: 1px solid rgba(251,191,36,0.4); }
.st-fix { background: rgba(34,197,94,0.2); color: #22c55e; border: 1px solid rgba(34,197,94,0.4); }
.st-dis { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.2); }

.m-actions { display: flex; gap: 12px; }
.act-btn { background: transparent; border: none; color: rgba(255,255,255,0.5); font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 6px; text-transform: uppercase; }
.act-btn:hover { color: #fff; transform: scale(1.05); }
.act-btn:hover i.fa-check { color: #22c55e; }
.act-btn:hover i.fa-wrench { color: #06b6d4; }
.act-btn:hover i.fa-xmark { color: #ef5350; }

/* Slide Panel (Detail) */
.aim-slide-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 999; transition: opacity 0.4s; }
.aim-slide-panel { position: fixed; top: 0; right: 0; width: 100%; max-width: 600px; height: 100vh; background: #0d0b12; border-left: 1px solid rgba(255,255,255,0.1); z-index: 1000; box-shadow: -10px 0 30px rgba(0,0,0,0.5); transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; }
.aim-slide-panel.open { transform: translateX(0); }

.aim-detail-bg { position: absolute; top:0; left:0; width:100%; height:100%; background: linear-gradient(to bottom, rgba(239,83,80,0.3), #0d0b12); transition: background 0.3s; }
.aim-slide-body { padding: 24px; overflow-y: auto; flex-grow: 1; }

.aim-hero-icon { width: 60px; height: 60px; border-radius: 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; }

.aim-tabs { display: flex; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 12px; }
.aim-tab-mini { background: transparent; border: none; color: rgba(255,255,255,0.5); font-weight: 600; cursor: pointer; padding: 6px 12px; transition: 0.2s; text-transform: uppercase; font-size: 0.8rem; border-radius: 8px; }
.aim-tab-mini:hover { color: white; background: rgba(255,255,255,0.05); }
.aim-tab-mini.active { color: #06b6d4; background: rgba(6,182,212,0.1); }
.aim-det-section { animation: fadeInUp 0.3s forwards; }

.aim-markdown { font-size: 0.95rem; color: rgba(255,255,255,0.9); line-height: 1.6; }
.aim-markdown strong { color: #fff; }

.aim-code-box { background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); padding: 16px; border-radius: 8px; font-family: monospace; font-size: 0.9rem; }

.aim-linked-trade-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); padding: 16px; border-radius: 12px; cursor: pointer; transition: 0.2s; display: flex; justify-content: space-between; align-items: center; }
.aim-linked-trade-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(192,132,252,0.3); }

.aim-fix-card { background: rgba(34,197,94,0.05); border: 1px solid rgba(34,197,94,0.3); padding: 16px; border-radius: 12px; }

.aim-history-timeline { display: flex; flex-direction: column; gap: 16px; border-left: 2px solid rgba(255,255,255,0.1); margin-left: 8px; padding-left: 16px; }
.aim-hist-item { position: relative; font-size: 0.85rem; }
.aim-hist-item::before { content:''; position:absolute; left:-23px; top:4px; width:10px; height:10px; border-radius:50%; background: #ef5350; border:2px solid #0d0b12; }

.aim-sticky-cta { position: absolute; bottom: 0; left: 0; width: 100%; padding: 24px; background: linear-gradient(to top, #0d0b12 70%, transparent); display: flex; }

/* Rules Modal */
.aim-rules-list { display: flex; flex-direction: column; gap: 12px; }
.aim-rule-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); padding: 16px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; }
.aim-rule-card.disabled { opacity: 0.5; }

/* Scanning Modal */
.aim-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.aim-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.aim-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: popIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards; }
.aim-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: 0.3s; z-index: 10; }
.aim-modal__close:hover { color: white; }

.aim-giant-icon { font-size: 4rem; display: inline-block; }
.aim-progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.aim-progress-fill { height: 100%; border-radius: 4px; transition: width 0.2s linear; }

/* Tooltip */
.aim-tooltip { position: fixed; background: #140f19; border: 1px solid rgba(192,132,252,0.4); padding: 12px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 2000; pointer-events: none; font-size: 0.8rem; color: white; transform: translate(-50%, -120%); transition: opacity 0.2s; white-space: nowrap; }