/* 
   HTTP HEADER VIEWER - EXPERT WEB TOOLS
   Theme: 2025 Glassmorphism (High Contrast Fix)
*/

/* --- Fonts --- */
@font-face { font-family: 'Inter'; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Orbitron'; src: url('/fonts/orbitron-v35-latin-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Roboto Mono'; src: url('/fonts/roboto-mono-v31-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
    --bg-dark: #0a0a0f;
    --primary-accent: #3b82f6;
    --secondary-accent: #8b5cf6;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --card-bg: rgba(25, 25, 35, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.05);
    
    /* High Contrast Status Colors */
    --status-2xx: #34d399; /* Bright Emerald */
    --status-3xx: #fbbf24; /* Bright Amber */
    --status-4xx: #f87171; /* Bright Red */
    
    /* Link Colors */
    --link-color: #60a5fa; /* Light Blue */
    --link-hover: #93c5fd; /* Lighter Blue */

    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'Roboto Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, rgba(10, 10, 15, 0) 50%);
    z-index: -1;
    pointer-events: none;
}

/* --- Header --- */
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s;
}
.back-btn:hover { color: var(--primary-accent); }
.logo { font-family: var(--font-heading); font-size: 1.2rem; }
.logo span { color: var(--primary-accent); }

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 2rem 5%;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.tool-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tool-intro { text-align: center; margin-bottom: 2rem; }
.tool-intro h1 { font-family: var(--font-heading); margin-bottom: 0.5rem; font-size: 2rem; }
.tool-intro p { color: var(--text-muted); }

/* Input Form */
.url-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.url-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-code);
    outline: none;
}
.url-input:focus { border-color: var(--primary-accent); }

.fetch-btn {
    background: var(--primary-accent);
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1rem;
    white-space: nowrap;
}
.fetch-btn:hover:not(:disabled) { background: #2563eb; }
.fetch-btn:disabled { background: #475569; cursor: not-allowed; }

/* Custom Headers Accordion */
.custom-headers-section { margin-bottom: 2rem; }

.accordion-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    padding: 0;
}
.accordion-toggle:hover { color: #fff; }

.accordion-content {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.header-row { display: flex; gap: 10px; margin-bottom: 10px; }
.header-row input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.add-header-btn {
    background: transparent;
    border: 1px dashed var(--card-border);
    color: var(--text-muted);
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.add-header-btn:hover { border-color: var(--primary-accent); color: var(--primary-accent); }

.remove-header-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 10px;
}

/* Loader */
#loader { text-align: center; margin: 2rem 0; color: var(--text-muted); }
.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.view-toggle { background: rgba(0,0,0,0.3); padding: 4px; border-radius: 8px; display: inline-flex; }
.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.toggle-btn.active { background: var(--primary-accent); color: #fff; }

.action-buttons button {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.action-buttons button:hover { border-color: var(--primary-accent); color: var(--primary-accent); }

/* Parsed Result Cards (Hops) */
.hop-container {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.status-line {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--card-border);
}

.hop-number {
    background: rgba(255,255,255,0.1);
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

.status-code { font-weight: bold; font-family: var(--font-code); }
.status-code.status-2xx { color: var(--status-2xx); }
.status-code.status-3xx { color: var(--status-3xx); }
.status-code.status-4xx, .status-code.status-5xx { color: var(--status-4xx); }

.hop-url { color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Headers Table & Link High Contrast Fix */
.headers-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-family: var(--font-code); }
.headers-table th, .headers-table td { text-align: left; padding: 10px 1rem; border-bottom: 1px solid rgba(255,255,255,0.03); }
.headers-table th { color: var(--text-muted); font-weight: 600; width: 30%; vertical-align: top; }
.headers-table td { color: #fff; word-break: break-all; line-height: 1.5; }
.headers-table tr:last-child td { border-bottom: none; }

/* FIX: Explicit Link Colors to override Browser Visited State */
.headers-table td a,
.headers-table td a:visited {
    color: var(--link-color) !important;
    text-decoration: none;
    border-bottom: 1px dotted rgba(96, 165, 250, 0.4);
    transition: all 0.2s;
}
.headers-table td a:hover {
    color: var(--link-hover) !important;
    border-bottom-style: solid;
}

.info-icon {
    color: var(--primary-accent);
    margin-left: 5px;
    cursor: help;
    font-size: 0.8rem;
}

/* Raw Output */
#raw-headers-output {
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 8px;
    font-family: var(--font-code);
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: pre-wrap;
    display: block;
}

.error-banner {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    text-align: center;
}

.hidden { display: none !important; }

/* Info Section */
.info-section { margin-top: 4rem; padding: 0 1rem; }
.info-section h2 { font-family: var(--font-heading); margin-bottom: 2rem; color: var(--text-main); font-size: 1.5rem; text-align: center; }
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}
.info-grid h3 { color: var(--primary-accent); margin-bottom: 0.5rem; font-family: var(--font-heading); font-size: 1rem; }
.info-grid p { color: var(--text-muted); font-size: 0.9rem; }

footer { text-align: center; padding: 3rem 0; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--card-border); margin-top: 3rem; }
footer a { color: #fff; text-decoration: none; }

@media (max-width: 768px) {
    .url-input-wrapper { flex-direction: column; }
    .status-line { flex-direction: column; align-items: flex-start; gap: 5px; }
    .headers-table th, .headers-table td { display: block; width: 100%; }
    .headers-table th { padding-bottom: 0; color: var(--secondary-accent); }
    .headers-table td { padding-top: 5px; }
}