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

:root {
    --bg-primary: #080a10;
    --bg-secondary: #0f1322;
    --bg-tertiary: #171d34;
    --border-color: #242c4c;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #00d9ff;
    --primary-glow: rgba(0, 217, 255, 0.15);
    --accent-red: #ff0055;
    --accent-red-glow: rgba(255, 0, 85, 0.15);
    --success: #00ff88;
    --success-glow: rgba(0, 255, 136, 0.15);
    --warning: #ffaa00;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 12px 40px -15px rgba(0, 0, 0, 0.7);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-red), var(--primary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 0 20px var(--accent-red-glow);
}

.logo-text h2 {
    font-size: 1.25rem;
    background: linear-gradient(to right, #ffffff, #00d9ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.02);
}

.nav-item.active a {
    color: white;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-red);
    font-weight: 600;
}

.profile-info h4 {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.profile-info p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2.5rem;
    max-width: 1200px;
}

/* Section Header */
.section-header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.section-title h1 {
    font-size: 2rem;
    color: white;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #00d9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-danger {
    background-color: var(--accent-red-glow);
    color: var(--accent-red);
    border: 1px solid rgba(255, 0, 85, 0.3);
}

/* Dashboard Grid layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.agent-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 992px) {
    .dashboard-grid, .agent-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(0, 217, 255, 0.3);
}

.card-title {
    font-size: 1.2rem;
    color: white;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accent-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-red { background-color: var(--accent-red); }
.dot-blue { background-color: var(--primary); }
.dot-green { background-color: var(--success); }

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.slider-val {
    color: var(--primary);
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    margin-top: 0.25rem;
}

select, input[type="number"] {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Outputs & Gauges */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    position: relative;
}

.radial-progress {
    width: 150px;
    height: 150px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.radial-progress svg {
    width: 150px;
    height: 150px;
    transform: rotate(-90deg);
}

.radial-progress circle {
    width: 100%;
    height: 100%;
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
}

.radial-progress .bg-circle {
    stroke: rgba(255, 255, 255, 0.05);
}

.radial-progress .val-circle {
    stroke: var(--success);
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 0.8s ease, stroke 0.8s ease;
}

.gauge-val {
    position: absolute;
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
    font-family: var(--font-heading);
}

.gauge-label {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Explainability List (SHAP contributions) */
.explain-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    width: 100%;
}

.explain-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.explain-factor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.explain-impact {
    font-weight: 600;
}

.impact-increase { color: var(--accent-red); }
.impact-decrease { color: var(--success); }

/* Chatbot Interface styling */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 520px;
    padding: 0;
    overflow: hidden;
}

.chat-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.agent-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--primary-glow);
    border: 1px solid var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.message {
    max-width: 85%;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.message.user {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message.agent {
    background-color: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.2);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-input-container {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.btn-send {
    background-color: var(--primary);
    border: none;
    color: black;
    font-weight: 700;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-send:hover {
    background-color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Suggested prompts list */
.prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.prompt-chip {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.prompt-chip:hover {
    border-color: var(--primary);
    color: white;
    background-color: var(--primary-glow);
}

/* SQL query & SQL response blocks */
.sql-query-block {
    font-family: var(--font-mono);
    background-color: #06080f;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.8rem;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.sql-table-container {
    max-height: 180px;
    overflow-y: auto;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.sql-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.sql-table th, .sql-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.sql-table th {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Tables and ROI layouts */
.details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.details-table th, .details-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.details-table th {
    color: var(--text-muted);
}

/* ROI result highlight cards */
.metric-highlight {
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(15, 19, 34, 0.8));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.metric-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary);
}

.metric-highlight.danger::before {
    background-color: var(--accent-red);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mini-metric {
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

.mini-metric-val {
    font-size: 1.15rem;
    font-weight: 600;
    color: white;
}

.mini-metric-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Tabs switcher styling */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
