/*
 * Lab Test Application - Main Stylesheet
 * ========================================
 * Modern, clean design with responsive layout.
 * Color scheme: Dark navy navbar, white content, blue accents.
 */

/* =============================================================================
   CSS Variables / Theme
   ============================================================================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --info: #0891b2;
    --info-light: #cffafe;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* =============================================================================
   Reset & Base Styles
   ============================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

code {
    background-color: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* =============================================================================
   Navigation Bar
   ============================================================================= */
.navbar {
    background: linear-gradient(135deg, var(--gray-900), var(--gray-800));
    color: var(--white);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand a {
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand i {
    color: var(--primary);
    font-size: 1.4rem;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: var(--gray-300);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    font-size: 0.875rem;
    color: var(--gray-300);
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-badge {
    background-color: var(--primary);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.logout-btn {
    color: var(--danger) !important;
}

.logout-btn:hover {
    background-color: rgba(220, 38, 38, 0.15) !important;
}

/* =============================================================================
   Main Container
   ============================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* =============================================================================
   Page Header
   ============================================================================= */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
}

.page-header p {
    color: var(--gray-500);
    margin-top: 4px;
    font-size: 1rem;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: var(--white);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
    color: var(--gray-800);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #b91c1c;
    color: var(--white);
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 1rem;
}

/* =============================================================================
   Login Page
   ============================================================================= */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 50%, var(--dark) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 4px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
}

.auth-tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auth-tab:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.auth-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    margin-bottom: -2px;
}

/* Auth Panels */
.auth-panel {
    display: none;
    padding: 2rem;
}

.auth-panel.active {
    display: block;
}

/* Login Form */
.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.demo-credentials {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--gray-600);
    text-align: center;
}

.demo-credentials code {
    background-color: var(--white);
    padding: 2px 8px;
    border: 1px solid var(--gray-200);
}

/* Auth Info (SAML/OIDC panels) */
.auth-info {
    text-align: center;
}

.auth-info-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.auth-info h3 {
    font-size: 1.25rem;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.auth-info p {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.auth-note {
    background-color: var(--gray-50);
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 1rem 2rem 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-error {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* =============================================================================
   Home Page Cards
   ============================================================================= */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none;
    color: var(--gray-800);
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: var(--gray-800);
}

.card-icon {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.card-api .card-icon { color: var(--success); }
.card-redirect .card-icon { color: var(--warning); }
.card-websocket .card-icon { color: var(--primary); }
.card-sse .card-icon { color: var(--info); }
.card-files .card-icon { color: #7c3aed; }

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--gray-500);
    font-size: 0.9rem;
    flex: 1;
    margin-bottom: 1rem;
}

.card-footer {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.card-tag {
    background-color: var(--gray-100);
    color: var(--gray-600);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* =============================================================================
   Token Section (Home Page)
   ============================================================================= */
.token-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.token-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.75rem;
}

.token-header h3 {
    flex: 1;
    font-size: 1rem;
    color: var(--gray-800);
}

.token-display {
    background-color: var(--gray-900);
    color: var(--success);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow-x: auto;
}

.token-display code {
    background: none;
    color: inherit;
    padding: 0;
    word-break: break-all;
    font-size: 0.8rem;
}

.token-info {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* =============================================================================
   Test Sections
   ============================================================================= */
.test-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.test-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-section h3 i {
    color: var(--primary);
}

/* =============================================================================
   API Testing Page
   ============================================================================= */
.api-docs {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.api-table th {
    background-color: var(--gray-50);
    padding: 10px 14px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
}

.api-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.method-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--white);
}

.method-badge.get { background-color: var(--success); }
.method-badge.post { background-color: var(--primary); }
.method-badge.put { background-color: var(--warning); }
.method-badge.delete { background-color: var(--danger); }

.api-test-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.api-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}

.api-method-select {
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.875rem;
    background-color: var(--gray-50);
    color: var(--gray-800);
    cursor: pointer;
    min-width: 100px;
}

.api-url-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Consolas', monospace;
    font-size: 0.875rem;
}

.api-url-input:focus, .api-method-select:focus {
    outline: none;
    border-color: var(--primary);
}

.api-body-section {
    display: none;
    margin-bottom: 1rem;
}

.api-body-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.api-body-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: 'Consolas', monospace;
    font-size: 0.875rem;
    resize: vertical;
}

.api-body-input:focus {
    outline: none;
    border-color: var(--primary);
}

.api-quick-actions {
    margin-bottom: 1.5rem;
}

.api-quick-actions h4 {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.api-response h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.response-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 0.75rem;
    align-items: center;
}

.response-status {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 700;
}

.status-success {
    background-color: var(--success-light);
    color: var(--success);
}

.status-error {
    background-color: var(--danger-light);
    color: var(--danger);
}

.response-time {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.response-body {
    background-color: var(--gray-900);
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

.response-body code {
    background: none;
    color: inherit;
    padding: 0;
    white-space: pre;
}

.error-text { color: var(--danger); }

/* =============================================================================
   Redirect Testing Page
   ============================================================================= */
.redirect-chain {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: center;
    margin: 1.5rem 0;
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.chain-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.chain-number {
    width: 28px;
    height: 28px;
    background-color: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.chain-arrow {
    color: var(--gray-400);
    margin: 0 10px;
    font-size: 1.2rem;
}

.chain-badge {
    background-color: var(--success-light);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Redirect Form */
.redirect-form {
    margin-top: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Code Block */
.code-block {
    position: relative;
    margin-top: 0.75rem;
}

.code-block pre {
    background-color: var(--gray-900);
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}

.code-block code {
    background: none;
    color: inherit;
    padding: 0;
}

.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* Trace Output */
.trace-output {
    margin-top: 1rem;
}

.trace-step {
    display: flex;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    align-items: flex-start;
}

.trace-redirect { background-color: var(--warning-light); }
.trace-success { background-color: var(--success-light); }
.trace-error { background-color: var(--danger-light); }

.trace-number {
    width: 28px;
    height: 28px;
    background-color: var(--gray-700);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.trace-details {
    flex: 1;
    font-size: 0.875rem;
}

.trace-details div {
    margin-bottom: 2px;
}

.trace-final {
    color: var(--success);
    font-weight: 600;
    margin-top: 6px;
}

.trace-note {
    color: var(--gray-500);
    font-size: 0.8rem;
    margin-top: 12px;
    padding: 10px;
    background-color: var(--gray-50);
    border-radius: var(--radius);
}

.status-code {
    font-weight: 700;
    background-color: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

/* =============================================================================
   WebSocket Testing Page
   ============================================================================= */
.ws-status-bar {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ws-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.ws-connected { color: var(--success); }
.ws-disconnected { color: var(--gray-400); }
.ws-error { color: var(--danger); }

.ws-controls {
    display: flex;
    gap: 8px;
}

.ws-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
}

.ws-input-section, .ws-log-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.ws-form-group {
    margin-bottom: 1.25rem;
}

.ws-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.ws-input-row {
    display: flex;
    gap: 8px;
}

.ws-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.ws-input-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.ws-quick-actions {
    margin-bottom: 1.5rem;
}

.ws-quick-actions h4 {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.ws-quick-actions .btn {
    margin-bottom: 4px;
}

.ws-info {
    background-color: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem;
}

.ws-info h4 {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.info-table {
    width: 100%;
    font-size: 0.85rem;
}

.info-table td {
    padding: 4px 0;
}

.info-table td:first-child {
    font-weight: 600;
    color: var(--gray-600);
    width: 140px;
}

/* WebSocket Log */
.ws-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.ws-log-header h3 {
    margin-bottom: 0;
}

.ws-log {
    background-color: var(--gray-900);
    border-radius: var(--radius);
    padding: 1rem;
    height: 500px;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
}

.ws-log-empty {
    text-align: center;
    color: var(--gray-500);
    padding: 3rem;
}

.ws-log-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

.ws-log-entry {
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ws-log-sent { background-color: rgba(37, 99, 235, 0.15); }
.ws-log-received { background-color: rgba(22, 163, 74, 0.15); }
.ws-log-system { background-color: rgba(100, 116, 139, 0.15); }
.ws-log-error { background-color: rgba(220, 38, 38, 0.15); }

.ws-log-time {
    color: var(--gray-500);
    min-width: 75px;
    flex-shrink: 0;
}

.ws-log-type {
    font-weight: 700;
    min-width: 90px;
    flex-shrink: 0;
}

.ws-log-sent .ws-log-type { color: var(--primary); }
.ws-log-received .ws-log-type { color: var(--success); }
.ws-log-system .ws-log-type { color: var(--gray-400); }
.ws-log-error .ws-log-type { color: var(--danger); }

.ws-log-message {
    color: #e2e8f0;
    word-break: break-all;
    white-space: pre-wrap;
    margin: 0;
    font-family: inherit;
    background: none;
    padding: 0;
}

/* =============================================================================
   SSE Testing Page
   ============================================================================= */
.sse-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sse-endpoint {
    font-size: 0.875rem;
}

.sse-endpoint label {
    font-weight: 600;
    color: var(--gray-600);
    margin-right: 8px;
}

.sse-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background-color: var(--gray-50);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.sse-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.sse-connected { color: var(--success); }
.sse-connecting { color: var(--warning); animation: pulse 1s infinite; }
.sse-disconnected { color: var(--gray-400); }
.sse-error { color: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sse-counter {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.sse-log {
    background-color: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
    min-height: 200px;
}

.sse-log-empty {
    text-align: center;
    color: var(--gray-400);
    padding: 3rem;
}

.sse-log-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.sse-log-entry {
    padding: 8px 12px;
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.sse-log-event {
    background: var(--white);
    border: 1px solid var(--gray-200);
}

.sse-log-system {
    background: var(--info-light);
    color: var(--info);
}

.sse-log-error {
    background: var(--danger-light);
    color: var(--danger);
}

.sse-event-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.sse-event-time {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.sse-event-badge {
    background-color: var(--primary);
    color: var(--white);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.sse-event-body {
    font-size: 0.85rem;
}

.sse-event-field {
    padding: 2px 0;
    color: var(--gray-700);
}

.info-content {
    font-size: 0.9rem;
    color: var(--gray-600);
}

.info-content ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.info-content li {
    margin-bottom: 4px;
}

.info-content h4 {
    font-size: 1rem;
    color: var(--gray-800);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

/* =============================================================================
   File Management Page
   ============================================================================= */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--gray-50);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.upload-icon {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.upload-area:hover .upload-icon {
    color: var(--primary);
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 4px;
    margin-bottom: 1rem;
}

.file-input {
    display: none;
}

/* Upload Progress */
.upload-progress {
    margin-top: 1rem;
}

.progress-bar {
    height: 8px;
    background-color: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 4px;
    display: block;
}

/* File List */
.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.file-list-header h3 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-table-container {
    overflow-x: auto;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th {
    background-color: var(--gray-50);
    padding: 12px 14px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
}

.file-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.file-row:hover {
    background-color: var(--gray-50);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.file-name i {
    color: var(--primary);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.file-size {
    color: var(--gray-600);
    font-family: 'Consolas', monospace;
}

.type-badge {
    background-color: var(--gray-100);
    color: var(--gray-600);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.file-date {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.file-actions {
    display: flex;
    gap: 6px;
}

.file-loading, .file-empty, .file-error {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
}

.file-error {
    color: var(--danger);
}

/* =============================================================================
   Error Page
   ============================================================================= */
.error-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.error-content {
    text-align: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 900;
    color: var(--gray-300);
    line-height: 1;
}

.error-message {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin: 1rem 0 2rem;
}

/* =============================================================================
   Footer
   ============================================================================= */
.footer {
    background-color: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: auto;
}

.footer-info {
    color: var(--gray-400);
}

/* =============================================================================
   Notification Toast
   ============================================================================= */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 9999;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-success {
    background-color: var(--success);
}

.notification-error {
    background-color: var(--danger);
}

.notification-info {
    background-color: var(--info);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* =============================================================================
   Responsive Design
   ============================================================================= */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 0.75rem 1rem;
        gap: 8px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-user {
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .ws-layout {
        grid-template-columns: 1fr;
    }

    .api-input-row {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .redirect-chain {
        flex-direction: column;
    }

    .chain-arrow {
        transform: rotate(90deg);
        margin: 6px 0;
    }

    .sse-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .ws-status-bar {
        flex-direction: column;
        gap: 10px;
    }
}
