@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #090d16;
    --bg-secondary: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.35);
    --accent-blue-hover: #2563eb;

    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.35);

    --accent-red: #f43f5e;
    --accent-red-glow: rgba(244, 63, 94, 0.35);

    --accent-amber: #f59e0b;
    --accent-purple: #a855f7;
    --accent-purple-glow: rgba(168, 85, 247, 0.35);
    --accent-purple-hover: #9333ea;

    --hover-blue: #60a5fa;
    --hover-emerald: #34d399;
    --hover-purple: #c084fc;
    --hover-amber: #fbbf24;

    --editor-bg: #0b0f19;
    --editor-color: #38bdf8;
    --console-bg: #05070c;
    --console-color: var(--text-primary);
}

body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.75);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(15, 23, 42, 0.15);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-blue: #2563eb;
    --accent-blue-glow: rgba(37, 99, 235, 0.15);
    --accent-emerald: #059669;
    --accent-emerald-glow: rgba(5, 150, 105, 0.15);
    --accent-red: #e11d48;
    --accent-red-glow: rgba(225, 29, 72, 0.15);
    --accent-amber: #d97706;
    --accent-purple: #7c3aed;
    --accent-purple-glow: rgba(124, 58, 237, 0.15);

    --hover-blue: #1d4ed8;
    --hover-emerald: #047857;
    --hover-purple: #7e22ce;
    --hover-amber: #b45309;

    --editor-bg: #f8fafc;
    --editor-color: #0284c7;
    --console-bg: #f1f5f9;
    --console-color: #0f172a;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: -0.01em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.container-fluid {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Glassmorphism Card Panels */
.glass-card {
    padding: 2%;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5,
.card-header h6 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.card-body {
    padding: 20px;
}

/* Premium Layout Elements */
.header-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
}

/* Code Editor Frame */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-header {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.window-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red {
    background-color: #ef4444;
}

.dot-yellow {
    background-color: #f59e0b;
}

.dot-green {
    background-color: #10b981;
}

.editor-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.editor-textarea {
    background: var(--editor-bg);
    border: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    color: var(--editor-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 16px;
    resize: none;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
    outline: none !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.editor-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

/* Fields & Input controls */
.form-control,
.form-select {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px var(--accent-blue-glow) !important;
}

.form-control-sm {
    padding: 6px 10px;
}

label.small {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

/* Customized Badge & Status */
.badge {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 30px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.connection-status-connected {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: var(--accent-emerald) !important;
    border: 1px solid var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald-glow);
}

.connection-status-disconnected {
    background-color: rgba(244, 63, 94, 0.15) !important;
    color: var(--accent-red) !important;
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red-glow);
}

/* Interactive Actions Grid */
.group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    font-weight: 700;
    border-left: 3px solid var(--accent-blue);
    padding-left: 8px;
}

.group-title-status {
    border-left-color: var(--accent-emerald);
}

.group-title-tx {
    border-left-color: var(--accent-purple);
}

.group-title-remote {
    border-left-color: var(--accent-amber);
}

.btn-action {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.825rem;
    font-weight: 500;
    padding: 10px 14px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-action:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--accent-blue);
    color: var(--hover-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-blue-glow);
}

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

/* Message class color accents */
.btn-status:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--accent-emerald);
    color: var(--hover-emerald);
    box-shadow: 0 4px 12px var(--accent-emerald-glow);
}

.btn-tx:hover {
    background: rgba(168, 85, 247, 0.08);
    border-color: var(--accent-purple);
    color: var(--hover-purple);
    box-shadow: 0 4px 12px var(--accent-purple-glow);
}

.btn-remote:hover {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--accent-amber);
    color: var(--hover-amber);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

/* Primary Trigger Buttons */
.btn-connect {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 14px var(--accent-emerald-glow);
}

.btn-connect:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

.btn-disconnect {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 14px var(--accent-red-glow);
}

.btn-disconnect:hover {
    background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.5);
    transform: translateY(-2px);
}

.btn-send {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: white;
    font-weight: 600;
    width: 100%;
    padding: 12px;
    box-shadow: 0 4px 14px var(--accent-blue-glow);
}

.btn-send:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

/* Terminal Console logs */
.console-container {
    margin-top: 24px;
}

.console-header {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.console-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.console-body {
    background-color: var(--console-bg);
    color: var(--console-color);
    border: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    padding: 16px 20px;
    height: 300px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.1);
}

.console-line {
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 6px;
}

/* Log arrows */
.log-inbound {
    color: #34d399;
    /* emerald green */
}

.log-outbound {
    color: #60a5fa;
    /* light blue */
}

.log-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 8px;
}

/* Pulse animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }

    100% {
        transform: scale(1);
    }
}

/* Chart background adjustments */
#performanceChart {
    background-color: #0b0f19 !important;
    border: 1px solid var(--border-color);
}

/* Load test running indicator */
.load-test-running {
    background-color: #ffc107 !important;
    color: #212529 !important;
    animation: pulse 1s infinite;
}

/* Login Overlay Styling */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #0f172a 0%, #090d16 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    width: 90%;
    max-width: 420px;
    padding: 40px 35px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    transition: all 0.3s ease;
}

.login-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: inline-block;
    filter: drop-shadow(0 0 12px var(--accent-emerald-glow));
    animation: pulse 2s infinite;
}

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-error-alert {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid var(--accent-red);
    color: #fda4af;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Light theme structural overrides */
body.light-theme .editor-header,
body.light-theme .console-header {
    background: #e2e8f0;
}

body.light-theme .login-overlay {
    background: radial-gradient(circle at center, #f8fafc 0%, #cbd5e1 100%);
}

body.light-theme .login-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.1);
}

body.light-theme .login-subtitle {
    color: #64748b;
}

body.light-theme .console-line {
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

body.light-theme .log-outbound {
    color: #2563eb;
    /* Darker blue for light theme visibility */
}

body.light-theme .btn-action {
    background: rgba(15, 23, 42, 0.03);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.light-theme .btn-action:hover {
    background: rgba(37, 99, 235, 0.08);
}

body.light-theme .badge {
    background-color: rgba(15, 23, 42, 0.03);
}

body.light-theme .btn-connect {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

body.light-theme .btn-disconnect {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

body.light-theme .btn-send {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Light theme overrides for form controls and text area */
body.light-theme .form-control,
body.light-theme .form-select {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.light-theme .editor-textarea {
    background-color: var(--editor-bg) !important;
    color: var(--editor-color) !important;
}

/* Light theme overrides for performance chart */
body.light-theme #performanceChart {
    background-color: var(--bg-primary) !important;
}

body.light-theme .bg-dark {
    background-color: var(--bg-secondary) !important;
}

/* Performance metrics card theme adaptations */
.performance-metrics .card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary);
}

body.light-theme .performance-metrics .card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Log system message colors */
.log-system {
    color: #94a3b8;
    font-weight: 500;
}

body.light-theme .log-system {
    color: #475569;
}

/* Test list short description */
.test-list-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 400;
}

body.light-theme .test-list-desc {
    color: #64748b;
}

/* Fullscreen Console Container overlay */
.console-container.fullscreen-console {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10000 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.console-container.fullscreen-console .console-header {
    border-radius: 0 !important;
}

.console-container.fullscreen-console .console-body {
    height: calc(100vh - 50px) !important;
    border-radius: 0 !important;
}