/* =========================================
   1. VARIABLES & RESET (Diamond Theme)
   ========================================= */
:root {
    /* Brand Colors */
    --primary: #2563eb;       /* Royal Blue */
    --primary-dark: #1e40af;
    --accent: #3b82f6;
    --dark: #0f172a;          /* Slate 900 */
    --light: #f8fafc;         /* Slate 50 */
    --white: #ffffff;
    
    /* Functional Colors */
    --success: #10b981;       /* Emerald */
    --warning: #f59e0b;       /* Amber */
    --danger: #ef4444;        /* Red */
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    /* Spacing & Borders */
    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Fonts */
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-ui);
    background-color: var(--light);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }

/* =========================================
   2. NAVBAR
   ========================================= */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--dark);
}

.highlight { color: var(--primary); }

.nav-links { display: flex; gap: 20px; align-items: center; }

.nav-item {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
}
.nav-item:hover { color: var(--primary); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--dark);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* =========================================
   3. HERO SECTION
   ========================================= */
.hero {
    text-align: center;
    padding: 80px 0 60px;
    background: radial-gradient(circle at top center, #eff6ff 0%, #f8fafc 100%);
}

.hero-content { max-width: 800px; margin: 0 auto; }

.badge {
    background: #dbeafe;
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin: 20px 0;
    color: var(--dark);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* Analyzer Input Box */
.analyzer-box {
    background: var(--white);
    padding: 10px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid #e2e8f0;
}

.input-group {
    display: flex;
    gap: 10px;
    padding: 5px;
}

.input-icon {
    font-size: 1.2rem;
    padding: 15px 0 15px 15px;
    color: var(--text-muted);
}

input[type="url"] {
    flex: 1;
    border: none;
    font-size: 1rem;
    outline: none;
    color: var(--dark);
}

#analyzeBtn {
    background: var(--primary);
    color: white;
    padding: 15px 30px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
#analyzeBtn:hover { background: var(--primary-dark); }

.analyzer-footer {
    margin-top: 15px;
    padding: 10px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =========================================
   4. LOADING & STATES
   ========================================= */
.hidden { display: none !important; }

.loading-section { padding: 60px 0; text-align: center; }
.loader-content {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    display: inline-block;
    box-shadow: var(--shadow-md);
}

/* Diamond Spinner */
.diamond-spinner {
    width: 50px;
    height: 50px;
    background: var(--primary);
    margin: 0 auto 20px;
    transform: rotate(45deg);
    animation: pulse-diamond 1.5s infinite ease-in-out;
}
@keyframes pulse-diamond {
    0% { transform: rotate(45deg) scale(1); opacity: 1; }
    50% { transform: rotate(45deg) scale(0.5); opacity: 0.5; }
    100% { transform: rotate(45deg) scale(1); opacity: 1; }
}

.error-section { text-align: center; padding: 40px 0; }
.error-box {
    background: #fef2f2;
    color: var(--danger);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid #fee2e2;
    display: inline-block;
}
.error-box i { font-size: 3rem; margin-bottom: 10px; display: block; }

/* =========================================
   5. DASHBOARD LAYOUT
   ========================================= */
.dashboard { padding: 40px 0; animation: slideUp 0.6s ease; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Report Header Grid */
.report-header-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Browser Frame (Screenshot) */
.browser-frame {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.browser-bar {
    background: #f1f5f9;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #e2e8f0;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.red { background: #ef4444; } .yellow { background: #f59e0b; } .green { background: #10b981; }
.fake-url {
    background: white;
    flex: 1;
    margin-left: 10px;
    border-radius: 4px;
    height: 20px;
    font-size: 10px;
    color: #999;
    padding: 3px 8px;
    overflow: hidden;
}
#finalScreenshot { width: 100%; height: auto; display: block; }

/* Tech Stack */
.tech-stack-row {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.stack-badge {
    background: var(--white);
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stack-badge img { width: 16px; height: 16px; }

/* Score Cards (Circular) */
.scores-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.score-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.score-card h3 {
    margin-top: 15px;
    font-size: 1rem;
    color: var(--text-muted);
}

/* The CSS Pie Chart Logic */
.circle-chart {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--score-color, #eee) var(--deg, 0deg), #f1f5f9 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.circle-chart::before {
    content: attr(data-score);
    width: 84px;
    height: 84px;
    background: white;
    border-radius: 50%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
}

/* =========================================
   6. METRICS & FILMSTRIP
   ========================================= */
.section-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}
.card-header { margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid #f1f5f9; }
.card-header h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }

/* Filmstrip */
.filmstrip-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}
.film-frame {
    flex: 0 0 auto;
    width: 100px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.film-frame img {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 5px;
}

/* Core Web Vitals Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.metric-tile {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #e2e8f0; /* Default border, JS changes this */
}
.metric-head { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; margin-bottom: 5px; }
.metric-val { font-size: 1.8rem; font-weight: 800; font-family: var(--font-mono); margin-bottom: 5px; }
.metric-desc { font-size: 0.8rem; color: #94a3b8; line-height: 1.4; }

/* =========================================
   7. DETAILED LISTS (Tabs & Tables)
   ========================================= */
.details-section { background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }

.tabs-nav { display: flex; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.tab-btn {
    padding: 15px 25px;
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: white; }

.tab-content { display: none; padding: 25px; }
.tab-content.active { display: block; }

.audit-list { display: flex; flex-direction: column; gap: 15px; }

/* Audit Item */
.audit-item { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.audit-summary {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: white;
}
.audit-summary:hover { background: #f8fafc; }

.audit-head-left { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.severity-dot { width: 12px; height: 12px; border-radius: 50%; }

.audit-details {
    display: none;
    background: #f8fafc;
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    overflow-x: auto;
}
.audit-details table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.audit-details th { text-align: left; padding: 8px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid #e2e8f0; }
.audit-details td { padding: 8px; border-bottom: 1px solid #e2e8f0; font-family: var(--font-mono); color: var(--dark); }
.url-cell { max-width: 400px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.alert-banner {
    background: #eff6ff;
    color: var(--primary-dark);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

/* =========================================
   8. FOOTER & RESPONSIVE
   ========================================= */
.main-footer {
    background: var(--dark);
    color: var(--white);
    padding: 40px 0;
    margin-top: 60px;
}
.footer-content { display: flex; justify-content: space-between; align-items: center; }
.footer-right a { color: #94a3b8; margin-left: 20px; display: inline-flex; align-items: center; gap: 5px; }
.footer-right a:hover { color: var(--white); }

/* Mobile Tweaks */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .report-header-grid { grid-template-columns: 1fr; }
    .analyzer-box { padding: 10px; }
    .input-group { flex-direction: column; }
    #analyzeBtn { justify-content: center; }
    .footer-content { flex-direction: column; gap: 20px; text-align: center; }
    .footer-right a { margin: 10px; }
}