:root {
    --bg-main: #0f1115; /* Deeper black/grey for premium Adobe feel */
    --bg-surface: rgba(26, 28, 35, 0.75);
    --bg-surface-hover: rgba(38, 41, 51, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --accent-primary: #FF0000; /* True Adobe Red */
    --accent-secondary: #1473E6; /* Adobe Blue */
    --accent-glow: rgba(255, 0, 0, 0.45);
    
    --status-critical: #FF0000;
    --status-success: #12805C; /* Adobe Green */
    --status-warning: #D97706;
    --status-info: #1473E6;

    --font-main: 'Adobe Clean', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Snappy easing */
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 60%, rgba(20, 115, 230, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 90% 20%, rgba(255, 0, 0, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }


/* Typography */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }
p { line-height: 1.6; }

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.logo-icon {
    color: var(--accent-primary);
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.nav-item i { width: 20px; height: 20px; transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
.nav-item:hover i { transform: scale(1.1); }

.nav-item.active {
    background: linear-gradient(90deg, rgba(255,0,0,0.08) 0%, transparent 100%);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

/* Ripple effect on buttons */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}
@keyframes ripple-animation {
    to { transform: scale(4); opacity: 0; }
}

.sidebar-footer {
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 2rem 3rem;
    position: relative;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.header-titles h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.header-titles p {
    color: var(--text-secondary);
}

.stats-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
}
.stats-badge i { width: 16px; height: 16px; color: var(--status-success); }

/* States */
.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
    color: var(--text-secondary);
    gap: 1rem;
}

.spinner {
    animation: spin 1.5s linear infinite;
    color: var(--accent-primary);
    width: 32px;
    height: 32px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.error-icon { color: var(--status-critical); width: 48px; height: 48px; }
.hidden { display: none !important; }

/* Glass Cards */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}
.glass-card.no-padding { padding: 0; overflow: hidden; }
.glass-card:hover { border-color: rgba(255,255,255,0.15); }

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px -8px rgba(0,0,0,0.5); border-color: rgba(255,255,255,0.15); }

.stat-card.minimal { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(20, 115, 230, 0.1);
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s ease;
}
.stat-card:hover .stat-icon { transform: scale(1.05) rotate(-3deg); }
.stat-icon.warning { background: rgba(217, 119, 6, 0.1); color: var(--status-warning); }
.stat-icon.success { background: rgba(18, 128, 92, 0.1); color: var(--status-success); }
.stat-icon.info { background: rgba(255, 0, 0, 0.1); color: var(--accent-primary); }

.stat-info h3 { font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); margin-top: 0.25rem; }

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
}
.chart-card h3 { margin-bottom: 1rem; font-size: 1.1rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.5rem; }
.chart-container { position: relative; height: 300px; width: 100%; }

/* Tables & Controls */
.controls-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
}
.search-box input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}
.search-box input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(255,0,0,0.15); }

.action-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.action-btn:hover { background: #CC0000; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255,0,0,0.3); }

.filter-select, select {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.table-responsive { width: 100%; overflow-x: auto; max-height: 65vh; }

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}
.data-table th {
    background: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--glass-border);
}
.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.95rem;
    vertical-align: top;
    transition: var(--transition);
}
.data-table tbody tr { transition: var(--transition); animation: slideInUp 0.4s ease forwards; opacity: 0; transform: translateY(10px); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.04); transform: scale(1.002); }
.data-table tbody tr:hover td { color: #fff; }

/* Stagger animation delay for table rows */
.data-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.10s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.20s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.data-table tbody tr:nth-child(n+6) { animation-delay: 0.30s; }

@keyframes slideInUp {
    to { opacity: 1; transform: translateY(0); }
}

.data-table.dense td { padding: 0.75rem 1rem; font-size: 0.9rem; }
.truncate { max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; transition: color 0.2s; }
.truncate:hover { color: var(--accent-secondary); cursor: pointer; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-critical { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-neutral { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

/* Agent Timeline */
.agent-selector-card { margin-bottom: 2rem; max-width: 500px; animation: slideInUp 0.4s ease; }
.agent-selector-card h3 { margin-bottom: 0.5rem; }
.agent-selector-card p { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.9rem; }
.custom-select select { width: 100%; padding: 0.875rem 1rem; font-size: 1rem; appearance: none; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%2394a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>'); background-repeat: no-repeat; background-position: right 1rem center; }
.custom-select select:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(255,0,0,0.15); }
.agent-stats-grid { display: flex; gap: 1rem; margin-bottom: 2rem; animation: slideInUp 0.5s ease; }
.agent-stats-grid .stat-card { flex: 1; }

.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--glass-border), transparent);
}
.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
    animation: slideInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}
.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(n+4) { animation-delay: 0.4s; }

.timeline-dot {
    position: absolute;
    left: -2rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-secondary);
    border: 3px solid var(--bg-main);
    top: 0.25rem;
    box-shadow: 0 0 10px rgba(20, 115, 230, 0.4);
    transition: var(--transition);
}
.timeline-item:hover .timeline-dot { transform: scale(1.3); }
.timeline-dot.critical { background: var(--status-critical); box-shadow: 0 0 10px rgba(255, 0, 0, 0.4); }
.timeline-content {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: var(--transition);
}
.timeline-item:hover .timeline-content {
    border-color: rgba(255,255,255,0.15);
    box-shadow: var(--glass-shadow);
    transform: translateX(4px);
}
.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    align-items: flex-start;
}
.timeline-date { color: var(--text-muted); font-size: 0.85rem; display: flex; align-items: center; }
.timeline-body p { margin-bottom: 0.75rem; font-size: 0.95rem; }
.timeline-body p strong { color: #fff; }

/* Markdown styling for feedback/notes */
.md-block { background: rgba(0,0,0,0.25); padding: 1.25rem; border-radius: 8px; font-family: monospace; font-size: 0.85rem; white-space: pre-wrap; margin-top: 0.5rem; border-left: 3px solid var(--accent-secondary); line-height: 1.5; color: #e4e4e7; }

/* Responsive */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--glass-border); padding: 1rem; flex-direction: row; align-items: center; justify-content: space-between; }
    .nav-menu { flex-direction: row; overflow-x: auto; padding: 0; margin-left: 1rem; }
    .nav-item { white-space: nowrap; padding: 0.5rem 1rem; }
    .logo-container { margin-bottom: 0; padding: 0; border-bottom: none; }
    .sidebar-footer { display: none; }
    .main-content { padding: 1.5rem; }
}
