/* ═══════════════════════════════════════════════════════════
   ePusConnext Test Dashboard — Style System
   Dark theme, glassmorphism, modern premium design
   ═══════════════════════════════════════════════════════════ */

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

/* ─── Design Tokens ────────────────────────────────────── */
:root {
    /* Background layers */
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1520;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(22, 31, 48, 0.8);
    --bg-input: rgba(15, 20, 30, 0.8);
    --bg-terminal: #070b12;

    /* Text */
    --text-primary: #e2e8f0;
    --text-secondary: #8892a6;
    --text-muted: #4a5568;
    --text-bright: #f1f5f9;

    /* Accent colors */
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.25);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.25);
    --accent-yellow: #f59e0b;
    --accent-yellow-glow: rgba(245, 158, 11, 0.25);
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.25);
    --accent-cyan: #06b6d4;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(59, 130, 246, 0.4);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);
    --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.15);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition-normal: 250ms var(--ease-out);
    --transition-slow: 400ms var(--ease-out);
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─── Layout ───────────────────────────────────────────── */
#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    background: rgba(10, 14, 23, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header__logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
}

.header__title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: -0.3px;
}

.header__subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header__status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-normal), box-shadow var(--transition-normal);
}

.status-dot--idle {
    background: var(--text-muted);
}

.status-dot--running {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px var(--accent-yellow-glow);
    animation: pulse 1.5s infinite;
}

.status-dot--passed {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green-glow);
}

.status-dot--failed {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red-glow);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ─── Main Content ─────────────────────────────────────── */
.main {
    display: grid;
    grid-template-columns: 320px 1fr;
    flex: 1;
    min-height: 0;
}

/* ─── Sidebar (Feature Explorer) ───────────────────────── */
.sidebar {
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar__header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar__title {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.sidebar__count {
    font-size: 0.72rem;
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 500;
}

.sidebar__content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Feature Tree */
.feature-item {
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.feature-item__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    user-select: none;
}

.feature-item__header:hover {
    background: var(--bg-card-hover);
}

.feature-item__icon {
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.feature-item__icon--open {
    transform: rotate(90deg);
}

.feature-item__name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feature-item__file {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.feature-item__scenarios {
    padding-left: 16px;
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition-slow);
}

.feature-item__scenarios--open {
    max-height: 1000px;
}

.scenario-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    border-left: 2px solid transparent;
    margin: 2px 0;
}

.scenario-item:hover {
    background: var(--bg-card-hover);
    border-left-color: var(--accent-blue);
}

.scenario-item--selected {
    background: var(--accent-blue-glow);
    border-left-color: var(--accent-blue);
}

.scenario-item__icon {
    font-size: 0.8rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.scenario-item__info {
    flex: 1;
    min-width: 0;
}

.scenario-item__name {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.scenario-item__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

/* Tags */
.tag {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tag--feature {
    background: var(--accent-purple-glow);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.tag--scenario {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.tag:hover {
    filter: brightness(1.3);
    transform: scale(1.05);
}

/* ─── Content Panel ────────────────────────────────────── */
.content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Control Bar ──────────────────────────────────────── */
.controls {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(15, 21, 32, 0.5);
    backdrop-filter: blur(8px);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Select / Input */
.select, .input {
    appearance: none;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-width: 0;
}

.select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238892a6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.input {
    width: 200px;
}

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

.input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    box-shadow: var(--shadow-sm), var(--shadow-glow-blue);
}

.btn--primary:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn--primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn--danger {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn--danger:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.btn--ghost {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn--ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn--success {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
    box-shadow: var(--shadow-sm), var(--shadow-glow-green);
}

.btn--success:hover {
    box-shadow: var(--shadow-md), 0 0 30px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn__icon {
    font-size: 1rem;
}

.controls__spacer {
    flex: 1;
}

/* ─── Terminal / Log Area ──────────────────────────────── */
.terminal-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.terminal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(7, 11, 18, 0.6);
    border-bottom: 1px solid var(--border-color);
}

.terminal__title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal__title-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.terminal__title-dot--active {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green-glow);
    animation: pulse 1.5s infinite;
}

.terminal__actions {
    display: flex;
    gap: 6px;
}

.terminal {
    flex: 1;
    background: var(--bg-terminal);
    padding: 16px 24px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    scroll-behavior: smooth;
}

.terminal__line {
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
    padding: 1px 0;
}

.terminal__line--info {
    color: var(--text-primary);
}

.terminal__line--success {
    color: var(--accent-green);
}

.terminal__line--error {
    color: var(--accent-red);
}

.terminal__line--warning {
    color: var(--accent-yellow);
}

.terminal__line--system {
    color: var(--accent-cyan);
    font-style: italic;
}

.terminal__line--separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.terminal__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--text-muted);
}

.terminal__empty-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.terminal__empty-text {
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.terminal__empty-hint {
    font-size: 0.78rem;
    font-family: 'Inter', sans-serif;
    opacity: 0.5;
}

/* ─── Footer / Status Bar ──────────────────────────────── */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(10, 14, 23, 0.9);
    font-size: 0.75rem;
    color: var(--text-muted);
    backdrop-filter: blur(8px);
}

.footer__left, .footer__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer__item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer__item--pass {
    color: var(--accent-green);
}

.footer__item--fail {
    color: var(--accent-red);
}

/* ─── Loading Shimmer ──────────────────────────────────── */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    height: 32px;
    margin: 4px 8px;
}

/* ─── Connection Status Toast ──────────────────────────── */
.toast {
    position: fixed;
    bottom: 48px;
    right: 24px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    z-index: 1000;
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--transition-normal);
    pointer-events: none;
}

.toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.toast--success {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 4px 20px var(--accent-green-glow);
}

.toast--error {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 4px 20px var(--accent-red-glow);
}

/* ─── Modal (Popups) ───────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 400px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.modal-overlay--visible .modal {
    transform: translateY(0) scale(1);
}

.modal__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal__header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal__close:hover {
    color: var(--text-bright);
}

.modal__body {
    padding: 20px;
    background: var(--bg-primary);
}

.modal__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .main {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .controls {
        padding: 12px 16px;
    }

    .input {
        width: 140px;
    }
}
