/* PlantPulse Dashboard — matches landing page design system */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-card-hover: #1a1a1a;
    --text-primary: #f0f0f0;
    --text-secondary: #8a8a8a;
    --text-muted: #555;
    --accent: #f59e0b;
    --accent-dim: rgba(245, 158, 11, 0.12);
    --accent-glow: rgba(245, 158, 11, 0.25);
    --border: #222222;
    --border-light: #2a2a2a;
    --pulse-green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.12);
    --amber: #f59e0b;
    --amber-dim: rgba(245, 158, 11, 0.12);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
}

/* NAV */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10,10,10,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-dot {
    width: 8px;
    height: 8px;
    background: var(--pulse-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 8px var(--pulse-green);
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--pulse-green);
}

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

.status-dot-green { background: var(--pulse-green); box-shadow: 0 0 6px var(--pulse-green); }
.status-dot-amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-dot-red { background: var(--red); box-shadow: 0 0 6px var(--red); animation: pulse-dot 1s ease-in-out infinite; }

/* MAIN */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 5rem 2rem 2rem;
}

/* STATS BAR */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-light); }

.stat-card-green { border-left: 3px solid var(--pulse-green); }
.stat-card-amber { border-left: 3px solid var(--amber); }
.stat-card-red { border-left: 3px solid var(--red); }

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card-green .stat-value { color: var(--pulse-green); }
.stat-card-amber .stat-value { color: var(--amber); }
.stat-card-red .stat-value { color: var(--red); }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ACTIONS BAR */
.actions-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-primary:hover { background: #d97706; }

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.btn-sm {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

.btn-icon { font-size: 1rem; }

/* GRID */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* PANELS */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

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

.panel-body {
    padding: 1rem 1.25rem;
    max-height: 500px;
    overflow-y: auto;
}

.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: var(--bg-card); }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* BADGES */
.badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.badge-red { background: var(--red-dim); color: var(--red); border-color: rgba(239,68,68,0.3); }
.badge-green { background: var(--green-dim); color: var(--pulse-green); border-color: rgba(34,197,94,0.3); }
.badge-amber { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,158,11,0.3); }

/* EQUIPMENT LIST */
.equipment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.equipment-item:last-child { border-bottom: none; }
.equipment-item:hover { background: var(--bg-card-hover); margin: 0 -1.25rem; padding: 0.75rem 1.25rem; }

.eq-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.eq-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.eq-status-online { background: var(--pulse-green); box-shadow: 0 0 6px var(--pulse-green); }
.eq-status-caution { background: #eab308; box-shadow: 0 0 6px #eab308; }
.eq-status-warning { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.eq-status-critical { background: var(--red); box-shadow: 0 0 6px var(--red); animation: pulse-dot 1s ease-in-out infinite; }
.eq-status-offline { background: #555; }

.eq-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.eq-zone {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.eq-metrics {
    display: flex;
    gap: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.eq-metric {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.eq-metric-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.eq-metric-value {
    font-weight: 500;
}

.eq-metric-value.warn { color: var(--amber); }
.eq-metric-value.crit { color: var(--red); }

/* ALERTS LIST */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

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

.alert-severity {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.severity-critical { background: var(--red-dim); color: var(--red); }
.severity-high { background: var(--amber-dim); color: var(--amber); }
.severity-medium { background: var(--blue-dim); color: var(--blue); }
.severity-low { background: var(--bg-secondary); color: var(--text-secondary); }

.alert-body {
    flex: 1;
    min-width: 0;
}

.alert-equipment {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.alert-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.alert-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.alert-actions {
    flex-shrink: 0;
}

/* REPORT */
.report-panel .panel-body {
    max-height: 600px;
}

.report-content {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.report-content h1 { font-size: 1.3rem; color: var(--text-primary); margin: 1rem 0 0.5rem; }
.report-content h2 { font-size: 1.05rem; color: var(--accent); margin: 1.25rem 0 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
.report-content h3 { font-size: 0.9rem; color: var(--text-primary); margin: 0.75rem 0 0.35rem; }
.report-content p { margin: 0.35rem 0; }
.report-content strong { color: var(--text-primary); }
.report-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    background: var(--accent-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
}

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.8rem;
}

.report-content th, .report-content td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.report-content th {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-content ul, .report-content ol {
    padding-left: 1.25rem;
    margin: 0.35rem 0;
}

.report-content li {
    margin: 0.25rem 0;
}

.report-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.report-content em {
    color: var(--text-muted);
    font-style: italic;
}

/* REPORT HISTORY */
.report-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: color 0.15s;
}

.report-history-item:last-child { border-bottom: none; }
.report-history-item:hover { color: var(--accent); }

.report-history-title {
    font-size: 0.85rem;
    font-weight: 500;
}

.report-history-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.empty-state p { margin: 0.25rem 0; }
.text-muted { color: var(--text-muted); font-size: 0.8rem; }

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; }

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.btn-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 1.25rem;
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.modal-body th, .modal-body td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.modal-body th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* FOOTER */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* TOAST */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast-success { border-left: 3px solid var(--pulse-green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .stats-bar { grid-template-columns: repeat(3, 1fr); }
    .grid-2col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    main { padding: 4.5rem 1rem 1rem; }
    nav { padding: 0.75rem 1rem; }
    .actions-bar { flex-wrap: wrap; }
    .eq-metrics { display: none; }
}
