/* Theme & Variables - Slate/Indigo */
:root {
    --bg-base: #0F172A;
    /* Slate 900 */
    --bg-panel: #1E293B;
    /* Slate 800 */
    --bg-input: #0F172A;

    --primary: #6366F1;
    /* Indigo 500 */
    --primary-hover: #4F46E5;
    /* Indigo 600 */
    --secondary: #818CF8;
    --accent: #A5B4FC;

    --text-main: #F8FAFC;
    /* Slate 50 */
    --text-muted: #94A3B8;
    /* Slate 400 */

    --border: #334155;
    /* Slate 700 */
    --border-light: rgba(99, 102, 241, 0.3);

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(30, 41, 59, 0.6);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-box {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--border-light);
}

/* Main Workspace */
.workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    flex: 1;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: auto;
}

.input-panel {
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    gap: 1.5rem;
}

.details-panel {
    background: var(--bg-base);
    position: relative;
}

/* Panel Headers */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
    background: rgba(165, 180, 252, 0.1);
    color: var(--accent);
    border: 1px solid var(--border-light);
}

/* Forms */
.input-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.method-select {
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

#url-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#url-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#raw-headers {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
    outline: none;
}

#raw-headers:focus {
    border-color: var(--primary);
}

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

/* Glass Box Overview */
.glass-box {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.grade-overview {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-align: left;
}

.grade-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: var(--bg-input);
    border: 3px solid var(--primary);
    color: #FFF;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.grade-circle.A {
    border-color: var(--success);
    color: var(--success);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.grade-circle.B {
    border-color: #A3E635;
    color: #A3E635;
}

.grade-circle.C {
    border-color: var(--warning);
    color: var(--warning);
}

.grade-circle.D {
    border-color: #F97316;
    color: #F97316;
}

.grade-circle.F {
    border-color: var(--error);
    color: var(--error);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.grade-details h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    word-break: break-all;
}

.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.stat-label {
    color: var(--text-muted);
}

.stat-val {
    font-weight: 600;
    font-family: var(--font-mono);
}

.stat-val.error {
    color: var(--error);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease;
}

/* Categories */
.categories {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.cat-title {
    font-weight: 500;
}

.cat-score {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--primary);
}

/* Details Panel Tabs */
.panel-tabs {
    display: flex;
    height: 48px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    flex-shrink: 0;
    padding: 0 1rem;
}

.panel-tabs .tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0 1.25rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}

.panel-tabs .tab:hover {
    color: var(--text-main);
}

.panel-tabs .tab.active {
    color: var(--primary);
}

.panel-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* Details Content */
.tab-content {
    padding: 2rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.section-title:not(:first-child) {
    margin-top: 2.5rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.empty-state p {
    margin-top: 1rem;
}

/* Issue Cards */
.issues-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.issue-card {
    background: var(--bg-panel);
    border-left: 4px solid var(--error);
    border-radius: var(--radius-sm) var(--radius-sm) var(--radius-sm) var(--radius-sm);
    padding: 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.issue-card.warning {
    border-left-color: var(--warning);
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.issue-title {
    font-weight: 600;
    font-size: 1rem;
}

.issue-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.issue-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.issue-recommendation {
    background: rgba(99, 102, 241, 0.1);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid var(--border-light);
}

.rec-label {
    font-weight: 600;
    color: var(--primary);
    margin-right: 0.5rem;
}

.rec-code {
    font-family: var(--font-mono);
    color: var(--accent);
    margin-top: 0.25rem;
    display: block;
}

/* Passed Checks */
.passed-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.pass-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.pass-icon {
    color: var(--success);
    margin-top: 0.1rem;
}

.pass-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.pass-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Raw View */
.raw-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.raw-code {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Syntax in Raw */
.raw-header-name {
    color: var(--secondary);
    font-weight: 600;
}

.raw-header-val {
    color: var(--text-main);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    margin-left: auto;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #FFF;
    padding: 0.6rem 1.25rem;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: var(--shadow);
    transition: opacity 0.3s;
    z-index: 100;
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .input-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}