/* BGA Husterklatte Dashboard Styles - v1.0 */
:root {
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #dcfce7;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0,0,0,0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #dcfce7 50%, #f0fdf4 100%);
    color: var(--text);
    min-height: 100vh;
}
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
}
.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon { font-size: 2rem; }
.logo-text { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.header-links { display: flex; align-items: center; gap: 1rem; }
.header-link {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1rem; background: #dbeafe; color: #1e40af;
    border-radius: 8px; text-decoration: none; font-weight: 500;
    font-size: 0.875rem; transition: all 0.2s;
}
.header-link:hover { background: #bfdbfe; transform: translateY(-1px); }
.header-link.energie { background: #fef3c7; color: #92400e; }
.header-link.energie:hover { background: #fde68a; }
.main-container {
    display: flex; flex-direction: column; align-items: center;
    min-height: calc(100vh - 70px); padding: 1.5rem;
}
.chat-sidebar {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 20px; display: flex; flex-direction: column;
    width: 100%; max-width: 1200px; min-height: 380px; max-height: 550px;
    margin-bottom: 2rem; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}
.chat-header { padding: 1.25rem; border-bottom: 1px solid var(--border); }
.chat-header h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
.chat-header p { color: var(--text-muted); font-size: 0.85rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; }
.message { margin-bottom: 1rem; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message.user { text-align: right; }
.message-bubble {
    display: inline-block; max-width: 85%; padding: 0.75rem 1rem;
    border-radius: 16px; font-size: 0.9rem; line-height: 1.5;
}
.message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff; border-bottom-right-radius: 4px;
}
.message.assistant .message-bubble {
    background: var(--bg-input); border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.suggestion-btn {
    background: var(--primary-light); border: 1px solid var(--primary);
    color: var(--primary-dark); padding: 0.5rem 0.9rem; border-radius: 20px;
    font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.suggestion-btn:hover {
    background: var(--primary); color: #ffffff;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
}
.compound-info { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.5rem; text-align: center; }
.chat-input-container { padding: 1rem; border-top: 1px solid var(--border); }
.chat-input-wrapper { display: flex; gap: 0.5rem; }
.chat-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text); padding: 0.75rem 1rem; border-radius: 12px;
    font-size: 0.9rem; outline: none;
}
.chat-input:focus { border-color: var(--primary); }
.send-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none; color: #ffffff; padding: 0.75rem 1.25rem; border-radius: 12px;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4); }
.content-area { width: 100%; max-width: 1200px; padding: 0 1rem; }
.alerts-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    border: 1px solid #fcd34d; border-radius: 12px; padding: 1rem;
    margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(251, 191, 36, 0.15);
}
.alerts-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.alerts-header h3 { font-size: 0.95rem; font-weight: 600; color: #92400e; margin: 0; }
.alerts-badge {
    background: #22c55e; color: white; font-size: 0.75rem; font-weight: 700;
    padding: 0.25rem 0.6rem; border-radius: 12px;
}
.alerts-badge.warning { background: #f59e0b; }
.alerts-badge.critical { background: #dc2626; }
.alerts-list { display: flex; flex-direction: column; gap: 0.5rem; }
.alert-item {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.6rem 0.75rem; background: white; border-radius: 8px;
    border-left: 4px solid #22c55e;
}
.alert-item.warning { border-left-color: #f59e0b; background: #fffbeb; }
.alert-item.critical { border-left-color: #dc2626; background: #fef2f2; }
.alert-icon { font-size: 1.25rem; }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; font-size: 0.85rem; color: #1e293b; }
.alert-detail { font-size: 0.8rem; color: #64748b; }
.loxone-section {
    background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border);
    padding: 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 4px 20px var(--shadow);
}
.loxone-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.loxone-header h3 { margin: 0; font-size: 1rem; }
.loxone-total { display: flex; align-items: center; gap: 0.5rem; }
.total-label { color: var(--text-muted); font-size: 0.85rem; }
.total-value {
    font-size: 1.5rem; font-weight: 700;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.loxone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.loxone-card {
    background: var(--bg-input); border-radius: 12px; padding: 1rem;
    border: 1px solid var(--border); transition: all 0.3s ease;
}
.loxone-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.loxone-name { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.loxone-value { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.loxone-unit { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.loxone-sparkline { height: 35px; width: 100%; margin-top: 0.5rem; }
.kpi-grid-mini { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.kpi-mini {
    background: var(--bg-card); border-radius: 10px; padding: 0.75rem 1rem;
    border: 1px solid var(--border); display: flex; align-items: center;
    gap: 0.5rem; flex: 1; min-width: 130px;
}
.kpi-mini-icon { font-size: 1.25rem; }
.kpi-mini-value { font-size: 1.1rem; font-weight: 600; color: var(--primary); }
.kpi-mini-label { font-size: 0.75rem; color: var(--text-muted); }
.tab-navigation {
    display: flex; gap: 2px; margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    padding: 4px; border-radius: 12px; border: 1px solid #cbd5e1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); overflow-x: auto;
}
.tab-btn {
    flex: 1; padding: 12px 16px; background: transparent; border: none;
    color: #475569; font-weight: 500; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.5px; border-radius: 8px; cursor: pointer;
    transition: all 0.3s ease; white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); background: rgba(22, 163, 74, 0.1); }
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff; font-weight: 600; box-shadow: 0 4px 15px rgba(22, 163, 74, 0.4);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
.overview-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1000px) { .overview-grid { grid-template-columns: 1fr 1fr; } }
.chart-card {
    background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border);
    overflow: hidden; box-shadow: 0 4px 20px var(--shadow);
}
.chart-card-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.chart-card-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.chart-card-badge {
    background: var(--primary-light); color: var(--primary);
    padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 500;
}
.chart-card-body { padding: 1rem; height: 320px; }
.chart-card.full-width { grid-column: 1 / -1; }
.chart-card.full-width .chart-card-body { height: 380px; }
.chart-loading {
    display: flex; align-items: center; justify-content: center; height: 100%;
    color: var(--text-muted); flex-direction: column; gap: 1rem;
}
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.time-selector {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 1rem; padding: 0.75rem 1rem;
    background: var(--bg-card); border-radius: 12px;
    border: 1px solid var(--border); box-shadow: 0 2px 8px var(--shadow);
}
.time-label { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; margin-right: 0.5rem; }
.time-btn {
    padding: 0.5rem 1rem; background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text); font-size: 0.8rem; font-weight: 500; border-radius: 8px;
    cursor: pointer; transition: all 0.2s;
}
.time-btn:hover { border-color: var(--primary); color: var(--primary); }
.time-btn.active {
    background: var(--primary); color: white; border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}
@media (max-width: 768px) {
    .header { padding: 1rem; flex-direction: column; gap: 1rem; }
    .header-links { flex-wrap: wrap; justify-content: center; }
    .chat-sidebar { min-height: 320px; max-height: 420px; }
    .tab-btn { padding: 10px 12px; font-size: 11px; }
    .time-selector { flex-wrap: wrap; }
    .time-btn { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
}
