/* CoreSpeed Performance Analyzer Premium Stylesheet */
:root {
    --bg-dark: 222 15% 4.9%;
    --bg-card: 222 12% 8% / 0.8;
    --primary-orange: 24 100% 50%; /* Hacking Neon Orange */
    --primary-glow: 24 100% 60%;
    
    --green: 142.1 76.2% 45%;
    --orange: 24 100% 50%;
    --red: 346.8 77.2% 49.8%;
    
    --border: 222 10% 15% / 0.8;
    --border-hover: 222 10% 25% / 0.9;
    --text-main: 0 0% 98%;
    --text-muted: 215 5% 55%;
    
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: hsl(var(--bg-dark));
    color: hsl(var(--text-main));
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
}

/* Background Cyber Grid overlay */
.cyber-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 102, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 102, 0, 0.02) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

.cyber-accent {
    color: hsl(var(--primary-orange));
    text-shadow: 0 0 10px hsla(var(--primary-orange), 0.4);
}

/* Header & Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 75px;
    z-index: 100;
    background-color: hsla(var(--bg-dark), 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: hsl(var(--text-main));
    text-decoration: none;
}

.logo-icon {
    color: hsl(var(--primary-orange));
    width: 24px;
    height: 24px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: hsl(var(--text-muted));
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.nav-link:hover {
    color: hsl(var(--text-main));
}

.terminal-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background-color: #0b0d10;
    border: 1px solid hsl(var(--border));
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator-green {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

/* Section Header styling */
section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 3.5rem auto;
}

.section-subtitle {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: hsl(var(--primary-orange));
    display: inline-block;
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-desc {
    color: hsl(var(--text-muted));
}

/* Cyber Console input form */
.cyber-console {
    background-color: #080a0c;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5), 0 0 20px hsla(var(--primary-orange), 0.05);
}

.input-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.6fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.url-input-wrapper {
    position: relative;
}

.url-input-wrapper input {
    width: 100%;
    background-color: #121518;
    border: 1px solid hsl(var(--border));
    padding: 0.85rem 1rem 0.85rem 3rem;
    border-radius: 6px;
    color: hsl(var(--text-main));
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

.url-input-wrapper input:focus {
    outline: none;
    border-color: hsl(var(--primary-orange));
    box-shadow: 0 0 10px hsla(var(--primary-orange), 0.2);
}

.globe-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: hsl(var(--text-muted));
}

/* Device toggles styling */
.device-toggle-wrapper {
    display: flex;
    background-color: #121518;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 3px;
    justify-content: space-around;
}

.device-radio {
    flex: 1;
    cursor: pointer;
}

.device-radio input {
    display: none;
}

.radio-design {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem;
    border-radius: 4px;
    color: hsl(var(--text-muted));
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.device-radio input:checked + .radio-design {
    background-color: hsl(var(--primary-orange));
    color: white;
    box-shadow: 0 4px 10px hsla(var(--primary-orange), 0.25);
}

/* Buttons */
.btn-cyber {
    background: linear-gradient(135deg, hsl(var(--primary-orange)), hsl(var(--primary-glow)));
    color: white;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px hsla(var(--primary-orange), 0.35);
    transition: var(--transition);
}

.btn-cyber:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px hsla(var(--primary-orange), 0.5);
}

.btn-cyber:disabled {
    background: hsl(var(--border));
    color: hsl(var(--text-muted));
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Console logs panel */
.terminal-logs {
    background-color: #0b0c0f;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow: hidden;
}

.logs-header {
    background-color: #12151a;
    border-bottom: 1px solid hsl(var(--border));
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-title {
    color: hsl(var(--primary-orange));
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-cursor {
    width: 6px;
    height: 12px;
    background-color: hsl(var(--primary-orange));
    animation: blink 1s infinite alternate;
}

.logs-body {
    padding: 1rem;
    height: 120px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.log-line {
    color: #4ade80;
}

.log-line.text-muted {
    color: hsl(var(--text-muted));
}

.log-line.text-warn {
    color: #f59e0b;
}

@keyframes blink {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Auditor Results viewports */
.results-section {
    padding-top: 20px;
    padding-bottom: 100px;
}

.results-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
}

/* Cyber Cards style */
.cyber-card {
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.cyber-card:hover {
    border-color: hsl(var(--border-hover));
}

.score-gauge-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.score-gauge-card h3 {
    font-size: 1.1rem;
    color: hsl(var(--text-muted));
}

/* SVG Gauge meter components */
.gauge-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.gauge-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.gauge-bg {
    fill: none;
    stroke: #12151a;
    stroke-width: 12;
}

.gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.2, 0.8, 0.2, 1), stroke 0.5s;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-number {
    font-family: var(--font-mono);
    font-size: 3.25rem;
    font-weight: 700;
    line-height: 1;
}

.gauge-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Score colors logic */
.score-gauge-card.score-green .gauge-fill { stroke: #10b981; }
.score-gauge-card.score-green .gauge-number { color: #10b981; }
.score-gauge-card.score-green .gauge-label { color: #10b981; }

.score-gauge-card.score-orange .gauge-fill { stroke: #f97316; }
.score-gauge-card.score-orange .gauge-number { color: #f97316; }
.score-gauge-card.score-orange .gauge-label { color: #f97316; }

.score-gauge-card.score-red .gauge-fill { stroke: #ef4444; }
.score-gauge-card.score-red .gauge-number { color: #ef4444; }
.score-gauge-card.score-red .gauge-label { color: #ef4444; }

.score-color-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: hsl(var(--text-muted));
}

.leg-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.leg-color.green { background-color: #10b981; }
.leg-color.orange { background-color: #f97316; }
.leg-color.red { background-color: #ef4444; }

/* Metrics list */
.metrics-column {
    display: flex;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.metric-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.metric-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--text-muted));
}

.metric-acronym {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background-color: #12151a;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: hsl(var(--text-muted));
}

.metric-value-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.85rem;
    font-weight: 700;
}

.metric-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Metric status color bindings */
.metric-card.score-green .metric-value { color: #10b981; }
.metric-card.score-green .metric-status-indicator { background-color: #10b981; box-shadow: 0 0 8px #10b981; }
.metric-card.score-green .metric-bar-fill { background-color: #10b981; }

.metric-card.score-orange .metric-value { color: #f97316; }
.metric-card.score-orange .metric-status-indicator { background-color: #f97316; box-shadow: 0 0 8px #f97316; }
.metric-card.score-orange .metric-bar-fill { background-color: #f97316; }

.metric-card.score-red .metric-value { color: #ef4444; }
.metric-card.score-red .metric-status-indicator { background-color: #ef4444; box-shadow: 0 0 8px #ef4444; }
.metric-card.score-red .metric-bar-fill { background-color: #ef4444; }

.metric-bar-track {
    height: 4px;
    background-color: #12151a;
    border-radius: 2px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    width: 0;
    transition: width 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Opportunities panel rows */
.opportunities-row {
    grid-column: 1 / -1;
}

.opportunities-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.opp-header {
    display: flex;
    flex-direction: column;
}

.opp-header h3 {
    font-size: 1.25rem;
}

.opp-header p {
    font-size: 0.85rem;
    color: hsl(var(--text-muted));
}

.opportunities-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Expandable audit cards */
.opp-item {
    border: 1px solid hsl(var(--border));
    background-color: #0b0c0f;
    border-radius: 6px;
    overflow: hidden;
}

.opp-trigger {
    width: 100%;
    padding: 1.25rem;
    background: none;
    border: none;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: hsl(var(--text-main));
}

.opp-trigger-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.opp-trigger-left i {
    width: 18px;
    height: 18px;
}

.opp-item.score-red .opp-trigger-left i { color: #ef4444; }
.opp-item.score-orange .opp-trigger-left i { color: #f97316; }

.opp-savings {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #ef4444;
    font-weight: 700;
    margin-right: 1.5rem;
}

.opp-item.score-orange .opp-savings {
    color: #f97316;
}

.opp-icon {
    width: 16px;
    height: 16px;
    color: hsl(var(--text-muted));
    transition: transform 0.3s ease;
}

.opp-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.opp-content {
    padding: 0 1.25rem 1.25rem 1.25rem;
    color: hsl(var(--text-muted));
    font-size: 0.85rem;
    border-top: 1px dashed hsl(var(--border));
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.opp-item.active .opp-icon {
    transform: rotate(180deg);
}

/* Documentation panel */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.doc-item h4 {
    font-size: 1.1rem;
    color: hsl(var(--primary-orange));
    margin-bottom: 0.75rem;
}

.doc-item p {
    color: hsl(var(--text-muted));
    font-size: 0.9rem;
}

/* Footer Section */
.footer {
    border-top: 1px solid hsl(var(--border));
    background-color: #07090b;
    padding: 4.5rem 0 2rem 0;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(2, 1fr);
    gap: 3rem;
    margin-bottom: 3.5rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-brand p {
    color: hsl(var(--text-muted));
    font-size: 0.9rem;
    max-width: 260px;
}

.footer-links-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links-col h4 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    color: hsl(var(--primary-orange));
}

.footer-links-col a {
    color: hsl(var(--text-muted));
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links-col a:hover {
    color: hsl(var(--primary-orange));
}

.engine-specs {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid hsl(var(--border));
    padding-top: 1.5rem;
    font-size: 0.8rem;
    color: hsl(var(--text-muted));
}

.d-none {
    display: none !important;
}

/* Responsive breakdowns */
@media (max-width: 968px) {
    .input-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .btn-cyber {
        width: 100%;
    }
    
    .results-layout {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
    }
}

/* AI Code Fix Modal Styles */
#ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 5, 6, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#ai-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#ai-modal-overlay .modal-container {
    background-color: #080a0c;
    border: 1px solid hsl(var(--primary-orange) / 0.5);
    box-shadow: 0 0 30px hsla(var(--primary-orange), 0.15);
    border-radius: 8px;
    width: 90%;
    max-width: 680px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

#ai-modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: hsl(var(--primary-orange));
}

.modal-content {
    padding: 2rem;
}

.modal-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.modal-header-title h2 {
    font-size: 1.5rem;
    font-family: var(--font-heading);
    letter-spacing: 0.02em;
}

.modal-subtitle {
    color: hsl(var(--text-muted));
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* Code block styles */
.code-output-container {
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    background-color: #050608;
}

.code-header {
    background-color: #0b0d10;
    border-bottom: 1px solid hsl(var(--border));
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: hsl(var(--text-muted));
}

.btn-copy-code {
    background: none;
    border: none;
    color: hsl(var(--text-muted));
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    transition: var(--transition);
}

.btn-copy-code:hover {
    color: hsl(var(--primary-orange));
}

.code-block {
    display: block;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    color: #a9b2c3;
    max-height: 250px;
    background: none;
}

.explanation-box {
    background-color: hsl(var(--bg-card));
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.85rem;
}

.explanation-box strong {
    color: hsl(var(--primary-orange));
    font-family: var(--font-heading);
    display: block;
    margin-bottom: 0.35rem;
}

.explanation-box p {
    color: hsl(var(--text-muted));
    line-height: 1.45;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
