body { font-family: 'Roboto', sans-serif; background: #101820; color: #eee; margin: 0; }
h1 { text-align: center; color: #4caf50; margin-top: 20px; }

.dashboard {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  grid-auto-rows: 80px;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

.card {
  background: #292451;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  color: rgba(255, 255, 255, 0.87);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* Taşmayı engelle */
}
.card h2 { margin: 0 0 5px 0; font-size: 14px; font-weight: 400; white-space: nowrap; }
.card .value { font-size: 1.8em; margin-top: 5px; font-weight: 600; }
.card small { display: block; margin-top: 3px; font-size: 11px; color: #ddd; }

.graph {
  background: #262626;
  border-radius: 10px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}
.graph h2 {
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 16px;
}
.chart-time-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.flatpickr-input {
  background-color: #262626 !important;
  border: 1px solid #4caf50 !important;
  color: #4caf50 !important;
  padding: 3px 8px !important;
  border-radius: 5px !important;
  font-size: 0.8em !important;
  font-weight: 400 !important;
  cursor: pointer !important;
  text-align: center;
  width: 180px;
  box-shadow: none !important;
}
.flatpickr-input.historical {
    border-color: #fbc02d !important;
    color: #fbc02d !important;
}
.go-live-chart-btn {
  padding: 3px 8px; font-size: 0.8em; font-weight: 600; border: none; border-radius: 5px; cursor: pointer; background: #4caf50; color: white; transition: background 0.2s; }
.go-live-chart-btn:hover { background: #45a049; }

canvas {
    width: 100%;
    flex-grow: 1;
    min-height: 150px; /* Minimum yükseklik */
}

/* Özel Kart Stilleri */
.control-card {
  background: #262626;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 10px;
  border-radius: 10px; /* Card'dan almadığı için eklendi */
}
.mppt-currents-card {
  background: #fff; color: #333;
  padding: 10px;
  border-radius: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.mppt-currents-card h2 { color: #555; font-weight: 600; text-align: center; margin-bottom: 10px; font-size: 14px; }
.mppt-currents-card .mppt-row { font-size: 1em; margin-bottom: 5px; }
.mppt-currents-card .mppt-row b { font-weight: 600; min-width: 60px; display: inline-block; font-size: 0.9em; }
.mppt-currents-card .mppt-row .value { font-size: 1em; font-weight: 600; color: #000; }
.mppt-currents-card hr { border: 0; border-top: 1px solid #ddd; margin: 5px 0; }

.gauge-card {
    position: relative;
    background: #262626;
    padding: 10px;
    display: flex;
    flex-direction: column;
    border-radius: 10px; /* Card'dan almadığı için eklendi */
}
.gauge-card h2 { color: white; margin-bottom: 5px; text-align: center; font-size: 14px; }
.gauge-canvas-container {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}
#speedGaugeChart {
    max-width: 100%;
    max-height: 100%;
}
.gauge-text {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8em;
    font-weight: 600; color: white; text-align: center;
}
.gauge-text small { display: block; font-size: 0.4em; font-weight: 400; color: #aaa; margin-top: -5px; }

/* Kontrol Butonları Stilleri */
button.control-button { width: 90%; padding: 12px; font-size: 1em; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; background: #4caf50; color: white; transition: background 0.2s; margin-top: 5px; margin-bottom: 5px;}
button.control-button:hover { background: #45a049; }
button.power-button { background: #f44336; }
button.power-button.on { background: #4caf50; }
textarea.control-textarea { width: 90%; height: 60px; background: #333; border: 1px solid #555; color: white; border-radius: 8px; padding: 10px; margin-bottom: 10px; box-sizing: border-box; }

/* Flatpickr Takvim Stilleri */
.flatpickr-calendar {
    z-index: 9999 !important;
    background: #262626 !important;
    border: 1px solid #555 !important;
    color: #eee !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
}
 .flatpickr-month, .flatpickr-weekday, .flatpickr-weekdays, .numInputWrapper .numInput {
    color: #ccc !important;
    fill: #ccc !important;
}
.flatpickr-day { color: #ddd !important; border-radius: 4px !important; border: 1px solid transparent !important; }
.flatpickr-day:hover { background: #444 !important; color: #fff !important; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: #0d6efd !important; border-color: #0d6efd !important; color: #fff !important; }
.flatpickr-day.inRange { background: rgba(33, 150, 243, 0.3) !important; border-color: transparent !important; box-shadow: -5px 0 0 rgba(33, 150, 243, 0.3), 5px 0 0 rgba(33, 150, 243, 0.3) !important; color: #eee !important; }
.flatpickr-day.today { border-color: #fbc02d !important; color: #fbc02d !important; }
.flatpickr-time { border-top: 1px solid #555 !important; background: #333 !important; }
.flatpickr-time input, .flatpickr-time .flatpickr-am-pm { background: #444 !important; color: #eee !important; border: 1px solid #666 !important; }
.flatpickr-time .numInputWrapper span:hover { background: #555 !important; }
.flatpickr-calendar .flatpickr-presets {
    padding: 5px;
    text-align: center;
    border-top: 1px solid #555;
    background: #333 !important;
}
 .flatpickr-calendar .flatpickr-presets button {
    background: #444; color: #eee; border: none;
    padding: 5px 8px; margin: 2px; border-radius: 4px; cursor: pointer;
}
 .flatpickr-calendar .flatpickr-presets button:hover {
    background: #555;
}

/* --- Yüklenme Spinner Stili --- */
#loading-spinner {
    position: fixed; /* Sayfanın tamamını kaplasın */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Hafif karartma */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 8px solid #f3f3f3; /* Açık gri */
    border-top: 8px solid #2196f3; /* Mavi (Tema rengin) */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Toast Bildirim Stilleri --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 20px;
    border-radius: 5px;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(100%); /* Sağdan kayarak gelsin */
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background-color: #4CAF50; /* Yeşil */
}

.toast.error {
    background-color: #f44336; /* Kırmızı */
}

.toast.info {
    background-color: #2196F3; /* Mavi */
}

/* style.css */
.echart-container {
    width: 100%;
    height: 100%;
    /* Başlık vs. için olan boşluğu hesaba katmak gerekebilir, 
       ama önce 'maintainAspectRatio:false' sorununu çözdüğümüz 
       .graph { display: flex; ... } kodun varsa bu gerekmeyebilir. */
       
    /* Önceki .graph canvas CSS'inden daha basit bir çözüm: */
    /* .graph'ın yüksekliği grid tarafından ayarlanıyor varsayalım */
    /* .graph h2'nin yüksekliği ~40px diyelim */
    height: calc(100% - 40px); /* Başlık yüksekliğini dikey alandan düş */
}

/* Önceki Plan B çözümümüz zaten varsa, bu daha iyidir: */
.graph {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.graph h2 {
    flex-shrink: 0;
}
.echart-container { /* Canvas yerine */
    flex-grow: 1;
    min-height: 0;
    width: 100%;
}

.gauge-card {
    position: relative; /* Yazının konumlanması için */
}

.gauge-card .echart-container {
    width: 100%;
    /* Yüksekliği 'h2' başlığı (~40px) ve alt metni (~30px) düşerek ayarla */
    height: calc(100% - 70px);
}

.gauge-card .gauge-text {
    /* Bu, göstergenin tam ortasına metni yerleştirir */
    position: absolute;
    bottom: 15%; /* Göstergenin merkezine yakın bir yer */
    left: 50%;
    transform: translateX(-50%);
    font-size: 2em;
    font-weight: bold;
    color: #fff;
}
.gauge-card .gauge-text small {
    font-size: 0.5em;
    color: #aaa;
}

#login-box h1 {
    color: white;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

#login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    border-radius: 4px;
    box-sizing: border-box; /* Önemli */
}

#login-box button {
    width: 100%;
    padding: 12px;
    background-color: #2196f3; /* Panelin ana mavi rengi */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.2s;
}

#login-box button:hover {
    background-color: #1a78c2;
}

#login-error-message {
    color: #f44336; /* Kırmızı */
    margin-top: 15px;
    display: none; /* Başlangıçta gizli */
}

/* Yeni eklenen <select> menüsü için stil */
#login-box select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    border-radius: 4px;
    box-sizing: border-box; /* Önemli */
    font-family: inherit; /* Yazı tipini koru */
    font-size: 1rem;
}

/* Çıkış Yap butonu için (JS'e ekleyeceğiz) */
.logout-button {
    background-color: #b60000 !important; /* Kırmızı */
}
.logout-button:hover {
    background-color: #f44336 !important; /* Daha parlak kırmızı */
}

/* CSS dosyanıza bu stilleri ekleyin veya güncelleyin */

#login-overlay {
    position: fixed; /* Sayfaya sabitlenir, kaydırmadan etkilenmez */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a; /* Koyu arka plan */
    display: flex;          /* ORTALAMA İÇİN GEREKLİ */
    justify-content: center;/* YATAYDA ORTALAMA */
    align-items: center;    /* DİKEYDE ORTALAMA */
    z-index: 9999;          /* Her şeyin üstünde olmasını sağlar */
    opacity: 1;             /* Başlangıçta görünür */
    transition: opacity 0.3s ease; /* Yavaşça kaybolması için */
}

/* Bu stiller zaten sizde olmalı, kontrol edin */
#login-box {
    background-color: #2a2a2a;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 300px;
}