:root {
    --bg-dark: #0a0a10;
    --glass-bg: rgba(20, 20, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f0f0f5;
    --text-muted: #8b8b9d;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --status-passed: #10b981;
    --status-failed: #ef4444;
    --status-running: #f59e0b;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic background mesh gradient */
.background-mesh {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
    z-index: -1;
    animation: rotateMesh 30s linear infinite;
}

@keyframes rotateMesh {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Header */
header {
    padding: 1.5rem 3rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

h1 span {
    font-weight: 300;
    color: var(--text-muted);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--status-passed);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--status-passed);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Control Panel */
.control-panel {
    max-width: 1400px;
    margin: 1.5rem auto 0;
    padding: 1.5rem;
    border-radius: 12px;
    background: rgba(20, 20, 30, 0.6);
}

.creds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.cred-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}

.cred-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-purple);
    margin-bottom: 0.7rem;
    letter-spacing: 0.5px;
}

.cred-fields {
    display: flex;
    gap: 0.6rem;
}

.cred-fields input {
    flex: 1;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.cred-fields input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}
.primary-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .creds-grid { grid-template-columns: 1fr; }
    .cred-fields { flex-direction: column; }
}

/* Main Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    height: calc(100vh - 120px);
}

.panel {
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.badge {
    background: var(--accent-blue);
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
}

/* Scrollable areas */
.test-list, .log-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Test Card */
.test-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease-out forwards;
}

.test-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.test-id { font-weight: 600; font-size: 1.1rem; }

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-passed { background: rgba(16, 185, 129, 0.15); color: var(--status-passed); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-failed { background: rgba(239, 68, 68, 0.15); color: var(--status-failed); border: 1px solid rgba(239, 68, 68, 0.3); }
.status-running { background: rgba(245, 158, 11, 0.15); color: var(--status-running); border: 1px solid rgba(245, 158, 11, 0.3); }

.test-metrics {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 0.8rem;
    border-radius: 8px;
}

.metric-item span { color: var(--text-main); font-weight: 600; margin-left: 0.4rem; }

/* Log Item */
.log-item {
    padding: 1rem;
    border-left: 3px solid transparent;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 0 8px 8px 0;
    font-family: monospace;
    font-size: 0.85rem;
    animation: slideIn 0.3s ease-out forwards;
}

.log-item.info { border-left-color: var(--accent-blue); }
.log-item.warning { border-left-color: var(--status-running); }
.log-item.error { border-left-color: var(--status-failed); }
.log-item.request { border-left-color: var(--accent-purple); }

.log-meta { display: flex; justify-content: space-between; margin-bottom: 0.5rem; color: var(--text-muted); }
.log-agent { font-weight: 800; color: #fff; }
.log-payload { color: #a1a1aa; word-break: break-all; margin-top: 0.5rem; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Buttons */
.toggle-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; height: auto; }
    .panel { height: 600px; }
}

/* AWS Metric Cards */
.metric-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    transition: border-color 0.3s;
}
.metric-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
}
.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1;
}
.metric-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.metric-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #22c55e, #eab308);
    transition: width 0.6s ease, background 0.4s ease;
}
.metric-bar-fill.warn {
    background: linear-gradient(90deg, #eab308, #f97316) !important;
}
.metric-bar-fill.danger {
    background: linear-gradient(90deg, #f97316, #ef4444) !important;
}
.metric-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Historical Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.chart-container {
    background: rgba(18, 18, 24, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    height: 250px;
    position: relative;
}
