/* Greg's Farm v2 Dashboard Styles */
/* Brand Colors from Emergent Connext Guidelines */

:root {
    /* Primary Brand Colors */
    --brand-green: #6b8e23;          /* Olive Green - Primary */
    --brand-blue: #2a7ca0;           /* Blue - Primary */
    --brand-brown: #40351e;          /* Dark Brown - Primary */

    /* Secondary Brand Colors */
    --brand-cream: #f9eddc;          /* Cream - Secondary */
    --brand-gold: #ba7c2b;           /* Gold - Secondary */
    --brand-burgundy: #440008;       /* Dark Red/Burgundy - Secondary */

    /* Functional Colors */
    --status-online: #6b8e23;        /* Green = sensor functioning/online */
    --status-warning: #ba7c2b;       /* Gold = data alert (out of range) */
    --status-critical: #440008;      /* Burgundy = critical data alert */
    --status-offline: #999999;       /* Gray = sensor offline */

    /* UI Colors */
    --bg-dark: #40351e;              /* Dark brown background */
    --bg-sidebar: #2d2518;           /* Darker brown sidebar */
    --bg-card: #f9eddc;              /* Cream card background */
    --bg-input: #352d1c;             /* Input background */
    --text-light: #f9eddc;           /* Cream text - for dark backgrounds */
    --text-card: #2a7ca0;            /* Blue text - for cards/boxes */
    --text-white: #ffffff;           /* White text */
    --text-muted: #c5b89a;           /* Muted cream text */
    --border-color: #5a4d36;         /* Brown border */

    /* Chart Colors */
    --chart-1: #6b8e23;              /* Olive Green */
    --chart-2: #2a7ca0;              /* Blue */
    --chart-3: #ba7c2b;              /* Gold */
    --chart-4: #7cb342;              /* Light Green */
    --chart-5: #5c9dc4;              /* Light Blue */
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--brand-brown) 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
}

.login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.logo {
    max-height: 50px;
    max-width: 120px;
    object-fit: contain;
}

.logo-divider {
    color: var(--text-muted);
    font-size: 24px;
}

.login-card h1 {
    text-align: center;
    color: var(--brand-blue);
    margin-bottom: 8px;
    font-size: 28px;
}

.subtitle {
    text-align: center;
    color: var(--brand-blue);
    margin-bottom: 30px;
}

.error-message {
    background: rgba(68, 0, 8, 0.3);
    border: 1px solid var(--brand-burgundy);
    color: #ff6b6b;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--brand-blue);
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-white);
    font-size: 16px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--brand-green);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--brand-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #5a7a1e;
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    color: var(--brand-blue);
    font-size: 12px;
}

/* OAuth Buttons */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-google {
    background: #ffffff;
    color: #444444;
    border: 1px solid #dadce0;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-microsoft {
    background: #ffffff;
    color: #5e5e5e;
    border: 1px solid #8c8c8c;
}

.btn-microsoft:hover {
    background: #f3f3f3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--brand-blue);
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.login-divider span {
    padding: 0 15px;
    opacity: 0.7;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.dashboard-header {
    background: var(--brand-blue);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 40px;
    object-fit: contain;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-white);
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.9;
    color: var(--brand-cream);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--brand-cream);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Dashboard Content */
.dashboard-content {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-nav {
    padding: 15px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(249, 237, 220, 0.05);
    color: var(--text-light);
}

.nav-item.active {
    background: rgba(107, 142, 35, 0.2);
    color: var(--brand-green);
    border-left-color: var(--brand-green);
}

.nav-icon {
    width: 24px;
    margin-right: 12px;
    font-size: 18px;
    text-align: center;
    display: inline-block;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.export-section h4 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.date-range,
.date-range-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.date-label {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
}

.date-input {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-white);
    font-size: 12px;
    box-sizing: border-box;
}

.btn-export {
    width: 100%;
    padding: 10px;
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-export:hover {
    background: #237a94;
}

/* Main Panel */
.main-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-dark);
}

/* Alert Banner */
.alert-banner {
    background: rgba(186, 124, 43, 0.2);
    border: 1px solid var(--brand-gold);
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: var(--brand-gold);
}

.alert-banner.hidden {
    display: none;
}

.alert-banner.critical {
    background: rgba(68, 0, 8, 0.3);
    border-color: var(--brand-burgundy);
    color: #ff6b6b;
}

.alert-icon {
    font-size: 20px;
}

.btn-small {
    margin-left: auto;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
    font-size: 12px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--brand-cream);
}

.time-selector {
    display: flex;
    gap: 8px;
}

.time-btn {
    padding: 8px 16px;
    background: var(--brand-cream);
    border: 1px solid var(--brand-blue);
    border-radius: 4px;
    color: var(--brand-blue);
    cursor: pointer;
    transition: all 0.2s;
}

.time-btn:hover {
    border-color: var(--brand-green);
    background: var(--brand-cream);
    color: var(--brand-green);
}

.time-btn.active {
    background: var(--brand-green);
    border-color: var(--brand-green);
    color: white;
}

/* View Sections */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* Category Sections */
.category-section {
    margin-bottom: 25px;
}

.category-section h3 {
    font-size: 16px;
    color: var(--brand-cream);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Sensor Cards */
.sensor-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.sensor-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid var(--status-online);
}

.sensor-card.alert {
    border-left-color: var(--status-warning);
}

.sensor-card.critical-alert {
    border-left-color: var(--status-critical);
}

.sensor-card.offline {
    border-left-color: var(--status-offline);
    opacity: 0.7;
}

.sensor-card.water-leak-active {
    border-left-color: var(--status-critical);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(68, 0, 8, 0.1) 100%);
}

.sensor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.sensor-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-card);
}

.sensor-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(107, 142, 35, 0.2);
    color: var(--status-online);
}

.sensor-status.alert {
    background: rgba(186, 124, 43, 0.2);
    color: var(--brand-gold);
}

.sensor-status.critical-alert {
    background: rgba(68, 0, 8, 0.3);
    color: #ff6b6b;
}

.sensor-status.offline {
    background: rgba(153, 153, 153, 0.2);
    color: var(--status-offline);
}

.sensor-readings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sensor-readings.two-col {
    grid-template-columns: repeat(2, 1fr);
}

.reading {
    text-align: center;
}

.reading-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-card);
}

.reading-value.large {
    font-size: 24px;
}

.reading-value.critical {
    color: var(--status-critical);
}

.reading-value.warning {
    color: var(--status-warning);
}

.reading-label {
    font-size: 10px;
    color: var(--text-card);
    margin-top: 2px;
    opacity: 0.7;
}

.sensor-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(42, 124, 160, 0.2);
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.7;
}

/* Water Leak Specific */
.water-leak-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.water-leak-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    border: 3px solid var(--status-online);
}

.water-leak-card.leak-detected {
    border-color: var(--status-critical);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(68, 0, 8, 0.15) 100%);
    animation: pulse-alert 2s infinite;
}

@keyframes pulse-alert {
    0%, 100% { box-shadow: 0 0 0 0 rgba(68, 0, 8, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(68, 0, 8, 0.2); }
}

.water-leak-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.water-leak-status {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-card);
    margin-bottom: 8px;
}

.water-leak-status.leak {
    color: var(--status-critical);
}

.water-leak-name {
    font-size: 16px;
    color: var(--text-card);
    opacity: 0.8;
}

/* Cold Storage Specific */
.cold-storage-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.cold-storage-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 3px solid var(--status-online);
}

.cold-storage-card.warning {
    border-color: var(--status-warning);
}

.cold-storage-card.critical {
    border-color: var(--status-critical);
}

.cold-storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cold-storage-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-card);
}

.cold-storage-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.cold-storage-metric {
    text-align: center;
    padding: 16px;
    background: rgba(42, 124, 160, 0.05);
    border-radius: 8px;
}

.cold-storage-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-card);
}

.cold-storage-value.warning {
    color: var(--status-warning);
}

.cold-storage-value.critical {
    color: var(--status-critical);
}

.cold-storage-label {
    font-size: 12px;
    color: var(--text-card);
    opacity: 0.7;
    margin-top: 4px;
}

/* Feed Bin Specific */
.feed-bin-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.feed-bin-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 3px solid var(--status-online);
}

.feed-bin-card.warning {
    border-color: var(--status-warning);
}

.feed-bin-card.critical {
    border-color: var(--status-critical);
}

.feed-bin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.feed-bin-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-card);
}

.feed-bin-visual {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 150px;
    margin-bottom: 20px;
}

.feed-bin-tank {
    width: 100px;
    height: 140px;
    border: 4px solid var(--text-card);
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
    background: rgba(42, 124, 160, 0.1);
}

.feed-bin-level {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, var(--brand-gold) 0%, #8b5a1b 100%);
    transition: height 0.5s ease;
}

.feed-bin-level.low {
    background: linear-gradient(180deg, var(--status-warning) 0%, #8b4513 100%);
}

.feed-bin-level.critical {
    background: linear-gradient(180deg, var(--status-critical) 0%, #5a0004 100%);
}

.feed-bin-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.feed-bin-metric {
    text-align: center;
    padding: 12px;
    background: rgba(42, 124, 160, 0.05);
    border-radius: 8px;
}

.feed-bin-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-card);
}

.feed-bin-value.warning {
    color: var(--status-warning);
}

.feed-bin-value.critical {
    color: var(--status-critical);
}

.feed-bin-label {
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.7;
    margin-top: 4px;
}

/* Chart Grid */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-container {
    background: var(--brand-cream);
    border-radius: 8px;
    padding: 16px;
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--brand-blue);
}

.chart {
    height: 300px;
    position: relative;
}

.chart.large {
    height: 400px;
}

/* Plotly modebar styling */
.js-plotly-plot .modebar {
    background: rgba(249, 237, 220, 0.9) !important;
    border-radius: 4px;
    padding: 2px 4px;
}

.js-plotly-plot .modebar-btn {
    color: var(--brand-blue) !important;
}

.js-plotly-plot .modebar-btn:hover {
    color: var(--brand-green) !important;
}

.js-plotly-plot .modebar-btn.active {
    color: var(--brand-green) !important;
}

/* Sensor Select */
.sensor-select {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--text-card);
    border-radius: 4px;
    color: var(--text-card);
    font-size: 14px;
    cursor: pointer;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-card);
}

.stat-label {
    font-size: 12px;
    color: var(--text-card);
    margin-top: 4px;
    opacity: 0.7;
}

/* Map */
.map-container {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
}

.map-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-card);
}

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

.legend-dot.online {
    background: var(--status-online);
}

.legend-dot.alert {
    background: var(--status-warning);
}

.legend-dot.critical {
    background: var(--status-critical);
}

.legend-dot.offline {
    background: var(--status-offline);
}

/* Map Layer Toggle */
.map-layer-toggle {
    display: flex !important;
    background: var(--bg-card) !important;
    border-radius: 6px !important;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    z-index: 1000 !important;
}

.leaflet-top.leaflet-right .map-layer-toggle {
    margin-top: 10px;
    margin-right: 10px;
}

.map-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: none;
    color: var(--text-card);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.map-toggle-btn:first-child {
    border-right: 1px solid rgba(42, 124, 160, 0.2);
}

.map-toggle-btn:hover {
    background: rgba(42, 124, 160, 0.1);
}

.map-toggle-btn.active {
    background: var(--brand-blue);
    color: white;
}

/* Alerts List */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid var(--status-warning);
}

.alert-item.critical {
    border-left-color: var(--status-critical);
}

.alert-severity {
    font-size: 24px;
}

.alert-content {
    flex: 1;
}

.alert-message {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-card);
}

.alert-details {
    font-size: 13px;
    color: var(--text-card);
    opacity: 0.7;
}

.alert-explanation {
    font-size: 12px;
    color: var(--text-card);
    opacity: 0.85;
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(42, 124, 160, 0.08);
    border-radius: 6px;
    line-height: 1.5;
    border-left: 3px solid var(--brand-blue);
}

.no-alerts {
    text-align: center;
    padding: 40px;
    color: var(--text-card);
}

.no-alerts-icon {
    font-size: 48px;
    margin-bottom: 12px;
    color: var(--brand-green);
}

/* Thresholds */
.thresholds-section {
    margin-top: 30px;
}

.thresholds-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--brand-cream);
}

.thresholds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.threshold-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 16px;
}

.threshold-card h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-card);
}

.threshold-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-card);
    opacity: 0.8;
}

.threshold-value {
    color: var(--text-card);
    font-weight: 500;
    opacity: 1;
}

/* Leaflet Popup */
.leaflet-popup-content-wrapper,
.leaflet-container .leaflet-popup-content-wrapper {
    background: #f9eddc !important;
    color: #2a7ca0 !important;
    border-radius: 8px !important;
}

.leaflet-popup-tip,
.leaflet-container .leaflet-popup-tip {
    background: #f9eddc !important;
}

.sensor-popup {
    min-width: 180px;
    color: #2a7ca0;
}

.sensor-popup h4 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #2a7ca0;
}

.sensor-popup .popup-readings {
    display: grid;
    gap: 4px;
    font-size: 12px;
}

.sensor-popup .popup-reading {
    display: flex;
    justify-content: space-between;
}

/* Sensor Status View */
.status-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.status-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.status-card-count {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-card);
    line-height: 1;
}

.status-card-count.online {
    color: var(--status-online);
}

.status-card-count.stale {
    color: var(--brand-gold);
}

.status-card-count.offline {
    color: var(--status-offline);
}

.status-card-label {
    font-size: 14px;
    color: var(--text-card);
    margin-top: 8px;
    opacity: 0.8;
}

.diagnostics-section,
.pipeline-section,
.troubleshooting-section {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.diagnostics-section h3,
.pipeline-section h3,
.troubleshooting-section h3 {
    color: var(--text-card);
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(42, 124, 160, 0.2);
}

.diagnostics-table-container {
    overflow-x: auto;
}

.diagnostics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.diagnostics-table th,
.diagnostics-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(42, 124, 160, 0.1);
}

.diagnostics-table th {
    background: rgba(42, 124, 160, 0.1);
    color: var(--text-card);
    font-weight: 600;
}

.diagnostics-table td {
    color: var(--text-card);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: rgba(107, 142, 35, 0.2);
    color: var(--status-online);
}

.status-badge.stale {
    background: rgba(186, 124, 43, 0.2);
    color: var(--brand-gold);
}

.status-badge.offline {
    background: rgba(153, 153, 153, 0.2);
    color: var(--status-offline);
}

.pipeline-info {
    display: grid;
    gap: 12px;
}

.pipeline-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(42, 124, 160, 0.1);
}

.pipeline-label {
    color: var(--text-card);
    font-weight: 500;
}

.pipeline-value {
    color: var(--text-card);
    opacity: 0.8;
}

.troubleshooting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.troubleshooting-card {
    background: rgba(42, 124, 160, 0.05);
    border-radius: 6px;
    padding: 15px;
    border-left: 3px solid var(--brand-blue);
}

.troubleshooting-card h4 {
    color: var(--text-card);
    font-size: 14px;
    margin-bottom: 10px;
}

.troubleshooting-card ul {
    list-style: none;
    padding: 0;
}

.troubleshooting-card li {
    color: var(--text-card);
    font-size: 13px;
    padding: 5px 0 5px 15px;
    position: relative;
    opacity: 0.85;
}

.troubleshooting-card li::before {
    content: "\2022";
    color: var(--brand-blue);
    position: absolute;
    left: 0;
}

/* Quick Status Bar */
.quick-status-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
}

.quick-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(42, 124, 160, 0.05);
    border-radius: 6px;
    border-left: 4px solid var(--status-online);
}

.quick-status-item.warning {
    border-left-color: var(--status-warning);
}

.quick-status-item.critical {
    border-left-color: var(--status-critical);
    background: rgba(68, 0, 8, 0.05);
}

.quick-status-item.offline {
    border-left-color: var(--status-offline);
}

.quick-status-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(42, 124, 160, 0.1);
    border-radius: 50%;
}

.quick-status-info {
    flex: 1;
}

.quick-status-label {
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-status-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-card);
}

.quick-status-value.critical {
    color: var(--status-critical);
}

.quick-status-value.warning {
    color: var(--status-warning);
}

/* Water Leak Timeline */
.water-leak-timeline {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(42, 124, 160, 0.2);
}

.timeline-label {
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.7;
    margin-bottom: 6px;
}

.timeline-bar {
    height: 20px;
    background: var(--status-online);
    border-radius: 4px;
    display: flex;
    overflow: hidden;
}

.timeline-segment {
    height: 100%;
    transition: width 0.3s ease;
}

.timeline-segment.dry {
    background: var(--status-online);
}

.timeline-segment.leak {
    background: var(--status-critical);
}

.timeline-legend {
    display: flex;
    gap: 15px;
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-card);
    opacity: 0.7;
}

.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.timeline-legend-dot.dry {
    background: var(--status-online);
}

.timeline-legend-dot.leak {
    background: var(--status-critical);
}

/* Feed Bin Segmented Gauge */
.feed-bin-gauge {
    position: relative;
    width: 120px;
    height: 160px;
    margin: 0 auto 20px;
}

.feed-bin-gauge-tank {
    width: 100%;
    height: 100%;
    border: 4px solid var(--text-card);
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
    background: rgba(42, 124, 160, 0.05);
    display: flex;
    flex-direction: column-reverse;
}

.gauge-segment {
    width: 100%;
    transition: opacity 0.3s ease;
}

.gauge-segment.full {
    background: var(--status-online);
    flex: 1;
}

.gauge-segment.good {
    background: #7cb342;
    flex: 1;
}

.gauge-segment.low {
    background: var(--status-warning);
    flex: 1;
}

.gauge-segment.critical {
    background: var(--status-critical);
    flex: 1;
}

.gauge-segment.empty {
    background: transparent;
}

.gauge-labels {
    position: absolute;
    right: -35px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-card);
    opacity: 0.7;
}

.feed-bin-estimate {
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background: rgba(42, 124, 160, 0.05);
    border-radius: 6px;
}

.estimate-label {
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.7;
}

.estimate-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-card);
}

/* Cold Storage Excursion Timeline */
.excursion-timeline {
    margin-top: 20px;
    padding: 15px;
    background: rgba(42, 124, 160, 0.05);
    border-radius: 8px;
}

.excursion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.excursion-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-card);
}

.excursion-count {
    font-size: 12px;
    padding: 3px 10px;
    background: rgba(186, 124, 43, 0.2);
    color: var(--brand-gold);
    border-radius: 12px;
}

.excursion-count.none {
    background: rgba(107, 142, 35, 0.2);
    color: var(--status-online);
}

.excursion-bar {
    height: 24px;
    background: linear-gradient(90deg,
        var(--status-online) 0%,
        var(--status-online) 100%
    );
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.excursion-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    background: var(--status-warning);
    min-width: 3px;
}

.excursion-marker.critical {
    background: var(--status-critical);
}

.excursion-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-card);
    opacity: 0.6;
}

/* Water Leak Timeline Additional Styles */
.water-leak-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.water-leak-info {
    flex: 1;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.8;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-card);
    opacity: 0.6;
}

/* Excursion Segment */
.excursion-segment {
    height: 100%;
    transition: width 0.3s ease;
}

.excursion-segment.normal {
    background: var(--status-online);
}

.excursion-segment.warning {
    background: var(--status-warning);
}

.excursion-segment.critical {
    background: var(--status-critical);
}

.excursion-bar {
    display: flex;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(42, 124, 160, 0.1);
}

.excursion-legend {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 10px;
    color: var(--text-card);
    opacity: 0.7;
    flex-wrap: wrap;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.normal {
    background: var(--status-online);
}

.legend-color.warning {
    background: var(--status-warning);
}

.legend-color.critical {
    background: var(--status-critical);
}

.excursion-header span.warning {
    color: var(--status-warning);
    font-weight: 600;
}

/* Feed Bin Gauge Container */
.feed-bin-gauge-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    padding: 20px;
}

.feed-bin-gauge {
    position: relative;
    width: 80px;
    height: 200px;
    flex-shrink: 0;
}

.gauge-background {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    border: 3px solid var(--text-card);
    border-radius: 0 0 15px 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    opacity: 0.3;
}

.gauge-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top,
        var(--status-critical) 0%,
        var(--status-critical) 10%,
        var(--status-warning) 10%,
        var(--status-warning) 20%,
        var(--brand-gold) 20%,
        var(--brand-gold) 50%,
        var(--status-online) 50%,
        var(--status-online) 100%
    );
    border-radius: 0 0 12px 12px;
    transition: height 0.5s ease;
}

.gauge-markers {
    position: absolute;
    left: 100%;
    top: 0;
    bottom: 0;
    padding-left: 8px;
    width: 40px;
}

.gauge-markers .marker {
    position: absolute;
    transform: translateY(50%);
    font-size: 10px;
    color: var(--text-card);
    opacity: 0.7;
}

.feed-bin-info {
    flex: 1;
}

.feed-bin-metric.large .feed-bin-value {
    font-size: 42px;
    font-weight: 700;
}

.consumption-estimate {
    margin-top: 20px;
    padding: 15px;
    background: rgba(42, 124, 160, 0.08);
    border-radius: 8px;
}

.consumption-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(42, 124, 160, 0.1);
}

.consumption-item:last-child {
    border-bottom: none;
}

.consumption-label {
    font-size: 12px;
    color: var(--text-card);
    opacity: 0.8;
}

.consumption-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-card);
}

.consumption-item.warning .consumption-value {
    color: var(--status-warning);
}

.consumption-item.critical .consumption-value {
    color: var(--status-critical);
}

.consumption-note {
    font-size: 11px;
    color: var(--text-card);
    opacity: 0.6;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-nav {
        display: flex;
        padding: 0;
    }

    .nav-item {
        flex-direction: column;
        padding: 12px 16px;
        border-left: none;
        border-bottom: 3px solid transparent;
        font-size: 12px;
    }

    .nav-item.active {
        border-bottom-color: var(--brand-green);
    }

    .nav-icon {
        margin-right: 0;
        margin-bottom: 4px;
    }

    .sidebar-footer {
        display: none;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Threshold Calibration Styles - Redesigned
   ============================================ */

/* Header with buttons */
.threshold-actions-header {
    display: flex;
    gap: 12px;
}

.btn-primary {
    background: var(--brand-green);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #5a7a1f;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-card);
    border: 2px solid var(--text-muted);
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--brand-burgundy);
    color: var(--brand-burgundy);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status bar */
.threshold-status-bar {
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 500;
    margin-bottom: 20px;
    display: none;
}

.threshold-status-bar.saving {
    display: block;
    background: rgba(42, 124, 160, 0.1);
    color: var(--brand-blue);
    border: 1px solid var(--brand-blue);
}

.threshold-status-bar.success {
    display: block;
    background: rgba(107, 142, 35, 0.1);
    color: var(--brand-green);
    border: 1px solid var(--brand-green);
}

.threshold-status-bar.error {
    display: block;
    background: rgba(68, 0, 8, 0.1);
    color: var(--brand-burgundy);
    border: 1px solid var(--brand-burgundy);
}

/* Current Readings Summary */
.current-readings-summary {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 28px;
    border: 1px solid rgba(42, 124, 160, 0.15);
}

.current-readings-summary h3 {
    color: var(--brand-blue);
    font-size: 16px;
    margin: 0 0 4px 0;
}

.current-readings-summary .summary-note {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 16px 0;
}

.current-values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.current-value-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(42, 124, 160, 0.05);
    border-radius: 6px;
    border-left: 3px solid var(--brand-blue);
}

.current-value-item .cv-label {
    font-size: 13px;
    color: var(--text-card);
}

.current-value-item .cv-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-blue);
}

.current-value-item.cold .cv-value {
    color: #0088cc;
}

.current-value-item.feed .cv-value {
    color: var(--brand-green);
}

/* Threshold Settings Container */
.threshold-settings-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Threshold Section */
.threshold-section {
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.threshold-section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(42, 124, 160, 0.08), rgba(107, 142, 35, 0.05));
    border-bottom: 1px solid rgba(42, 124, 160, 0.1);
}

.threshold-section-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.temp-icon { color: #e74c3c; }
.humidity-icon { color: #3498db; }
.cold-icon { color: #00bcd4; }
.feed-icon { color: var(--brand-green); }
.water-icon { color: #2196f3; }

.threshold-section-title h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-card);
}

.threshold-section-title p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Threshold Table */
.threshold-table {
    padding: 0;
}

.threshold-table-header {
    display: grid;
    grid-template-columns: 100px 1fr 140px;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(42, 124, 160, 0.04);
    border-bottom: 1px solid rgba(42, 124, 160, 0.1);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.threshold-table-row {
    display: grid;
    grid-template-columns: 100px 1fr 140px;
    gap: 16px;
    padding: 14px 20px;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.15s;
}

.threshold-table-row:last-child {
    border-bottom: none;
}

.threshold-table-row:hover {
    background: rgba(42, 124, 160, 0.03);
}

.threshold-table-row.warning-row {
    border-left: 4px solid var(--brand-gold);
}

.threshold-table-row.critical-row {
    border-left: 4px solid var(--brand-burgundy);
}

/* Alert Badges */
.alert-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-badge.warning {
    background: rgba(186, 124, 43, 0.15);
    color: #8b5a00;
}

.alert-badge.critical {
    background: rgba(68, 0, 8, 0.12);
    color: var(--brand-burgundy);
}

/* Alert Description */
.alert-desc {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-desc strong {
    font-size: 14px;
    color: var(--text-card);
}

.alert-desc small {
    font-size: 12px;
    color: var(--text-muted);
}

/* Threshold Input */
.threshold-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.threshold-field {
    width: 90px;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    text-align: right;
    background: #fff;
    color: var(--text-card);
    transition: all 0.2s;
}

.threshold-field:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(42, 124, 160, 0.15);
}

.warning-row .threshold-field {
    border-color: rgba(186, 124, 43, 0.4);
}

.warning-row .threshold-field:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(186, 124, 43, 0.15);
}

.critical-row .threshold-field {
    border-color: rgba(68, 0, 8, 0.3);
}

.critical-row .threshold-field:focus {
    border-color: var(--brand-burgundy);
    box-shadow: 0 0 0 3px rgba(68, 0, 8, 0.15);
}

.field-unit {
    font-size: 14px;
    color: var(--text-muted);
    min-width: 24px;
}

/* Water Leak Info */
.water-leak-info {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: rgba(33, 150, 243, 0.05);
}

.water-leak-info .info-icon {
    font-size: 24px;
    color: #2196f3;
    flex-shrink: 0;
}

.water-leak-info .info-text strong {
    display: block;
    font-size: 14px;
    color: var(--text-card);
    margin-bottom: 4px;
}

.water-leak-info .info-text p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.inline-critical {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(68, 0, 8, 0.12);
    color: var(--brand-burgundy);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .threshold-actions-header {
        width: 100%;
    }

    .threshold-actions-header .btn-primary,
    .threshold-actions-header .btn-secondary {
        flex: 1;
    }

    .threshold-table-header {
        display: none;
    }

    .threshold-table-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 16px 20px;
    }

    .threshold-input-wrap {
        justify-content: flex-end;
    }

    .current-values-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================ */
/* Ask Rex - AI Farm Assistant Styles          */
/* ============================================ */

.rex-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Rex Introduction Card */
.rex-intro {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    border-left: 4px solid var(--brand-green);
}

.rex-avatar {
    font-size: 48px;
    line-height: 1;
}

.rex-welcome h3 {
    color: var(--brand-blue);
    margin-bottom: 8px;
    font-size: 20px;
}

.rex-welcome p {
    color: var(--text-card);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* Quick Action Buttons */
.rex-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--brand-blue);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: var(--brand-green);
    color: white;
    border-color: var(--brand-green);
}

/* Chat Container */
.rex-chat-container {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.rex-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
}

.rex-messages:empty::before {
    content: "Start a conversation with Rex by typing a question or clicking a quick action button above.";
    display: block;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-style: italic;
}

/* Messages */
.rex-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.rex-message.user-message {
    flex-direction: row-reverse;
}

.rex-message.user-message .message-content {
    background: var(--brand-blue);
    color: white;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
}

.rex-message.rex-response .message-content {
    background: #e8e8e8;
    color: var(--brand-brown);
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
}

.message-avatar {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.message-content {
    padding: 12px 16px;
}

.message-text {
    font-size: 14px;
    line-height: 1.6;
}

.message-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text li {
    margin-bottom: 4px;
}

.message-text strong {
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator .typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--brand-blue);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input Area */
.rex-input-container {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
}

.rex-input {
    flex: 1;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    color: var(--brand-brown);
}

.rex-input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(42, 124, 160, 0.15);
}

.rex-input::placeholder {
    color: #999;
}

.rex-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.rex-send-btn {
    background: var(--brand-green);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.rex-send-btn:hover:not(:disabled) {
    background: #5a7a1f;
}

.rex-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Status Bar */
.rex-status-bar {
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.rex-status-bar.error {
    color: var(--status-critical);
    background: rgba(68, 0, 8, 0.1);
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .rex-intro {
        flex-direction: column;
        text-align: center;
    }

    .rex-quick-actions {
        justify-content: center;
    }

    .rex-messages {
        height: 350px;
    }

    .rex-message.user-message .message-content,
    .rex-message.rex-response .message-content {
        max-width: 85%;
    }

    .rex-input-container {
        flex-direction: column;
    }

    .rex-send-btn {
        width: 100%;
    }
}
