/* ==========================================================================
   ELITE FIRM RULES LIBRARY CSS
   Glassmorphism, Comparison Tables, Scoring
   ========================================================================== */

/* Layout & Globals */
.fr-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; display: flex; flex-direction: column; gap: 24px; position: relative; }
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.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-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; } .p-16 { padding: 16px; } .pt-16 { padding-top: 16px; } .border-top { border-top: 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%; } .w-50 { width: 50%; } .text-center { text-align: center; }
.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; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; }

/* Palette */
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-white { color: #ffffff; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@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); } }
.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseGlow 2s infinite; border-radius: 12px; }

/* Cards & Buttons */
.fr-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; }

.fr-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; }
.fr-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.fr-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.fr-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.fr-btn--secondary:hover { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.fr-btn-icon-small { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.fr-btn-icon-small:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; transform: rotate(-180deg); }

.fr-input, .fr-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; }
.fr-input:focus, .fr-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.fr-form-group { margin-bottom: 16px; }
.fr-form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); font-weight: 600; }

.fr-range { -webkit-appearance: none; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; outline: none; }
.fr-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #c084fc; cursor: pointer; box-shadow: 0 0 10px rgba(192,132,252,0.5); transition: 0.2s; }

/* Header */
.fr-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.fr-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.fr-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.fr-header__stats { display: flex; gap: 24px; }
.fr-stat-card { text-align: center; }
.fr-stat-val { display: block; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fr-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Filters */
.fr-filters { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: rgba(255,255,255,0.03); padding: 12px 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); }
.fr-search { position: relative; flex-grow: 1; max-width: 300px; }
.fr-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.4); }
.fr-search input { width: 100%; padding: 10px 14px 10px 36px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; outline: none; }
.fr-filter-group { display: flex; align-items: center; gap: 8px; }

/* Firm Grid */
.fr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 24px; }
.fr-firm-card { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; transition: 0.3s; position: relative; overflow: hidden; }
.fr-firm-card:hover { transform: translateY(-4px); background: rgba(255,255,255,0.05); border-color: rgba(192,132,252,0.4); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.fr-firm-card.selected { border-color: #06b6d4; background: rgba(6,182,212,0.05); box-shadow: 0 0 20px rgba(6,182,212,0.2); }

.f-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.f-logo { font-size: 2.5rem; line-height: 1; }
.f-title { font-size: 1.2rem; font-weight: 800; margin: 0; }
.f-est { font-size: 0.75rem; color: rgba(255,255,255,0.5); }
.f-rep { background: rgba(251,191,36,0.1); color: #fbbf24; padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; border: 1px solid rgba(251,191,36,0.3); }

.f-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 16px; }
.f-metric { display: flex; flex-direction: column; }
.f-metric .lbl { font-size: 0.7rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }
.f-metric .val { font-size: 0.95rem; font-weight: 700; }

.f-actions { display: flex; gap: 12px; margin-top: auto; }

/* Modals */
.fr-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.fr-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.fr-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: fadeInUp 0.3s ease-out; }
.fr-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; }
.fr-modal__close:hover { color: white; }

/* Detail Modal */
.fr-detail-content { width: 95%; max-width: 1100px; height: 90vh; display: flex; flex-direction: column; padding: 32px; overflow-y: auto; }
.fr-detail-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.fr-hero-icon { font-size: 3rem; line-height: 1; }
.fr-detail-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; }

/* Tabs inside detail */
.fr-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.fr-tab { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); padding: 8px 16px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: 0.3s; font-size: 0.85rem; }
.fr-tab:hover { color: white; background: rgba(255,255,255,0.05); }
.fr-tab.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }

.spec-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 24px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.spec-box { display: flex; flex-direction: column; }
.spec-box .lbl { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; margin-bottom: 4px; }
.spec-box .val { font-size: 1.1rem; font-weight: 700; }

.spec-rules { padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rule-item { display: flex; justify-content: space-between; font-size: 0.85rem; border-bottom: 1px dashed rgba(255,255,255,0.05); padding-bottom: 8px; }
.rule-item .lbl { color: rgba(255,255,255,0.6); }
.rule-item .val { font-weight: 700; }
.val-ok { color: #22c55e; } .val-bad { color: #ef5350; } .val-warn { color: #fbbf24; }

.fr-list { margin: 0; padding-left: 20px; line-height: 1.5; }

/* Compare Modal */
.fr-compare-content { width: 95%; max-width: 1200px; height: 90vh; display: flex; flex-direction: column; padding: 32px; overflow: hidden; }
.fr-table-wrap { flex-grow: 1; overflow-y: auto; overflow-x: auto; background: rgba(0,0,0,0.2); border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.fr-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; white-space: nowrap; }
.fr-table th { text-align: left; padding: 16px; border-bottom: 2px solid rgba(255,255,255,0.1); background: rgba(14,12,18,0.9); position: sticky; top: 0; z-index: 10; font-weight: 800; }
.fr-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); font-variant-numeric: tabular-nums; }
.fr-table tr:hover td { background: rgba(255,255,255,0.02); }
.cell-winner { background: rgba(34,197,94,0.1); color: #4ade80; font-weight: 700; }
.cell-loser { color: #ef5350; }

.fr-rec-result { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); padding: 16px; border-radius: 12px; text-align: center; }