/* /public/assets/style.css */

:root {
  /* Color Variables */
  --primary-color: #005a9c;
  --primary-hover: #004a80;
  --bg-color: #f4f7f6;
  --text-color: #333;
  --text-muted: #6b7280;
  --card-bg: #fff;
  --border-color: #eee;
  
  /* Status Colors */
  --status-ok: #28a745;
  --status-manual: #17a2b8;
  --status-off: #6c757d;
  --status-alarm: #dc3545;
}

/* --- Global Reset & Base --- */
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: inherit;
}

h1, h2, h3, h4 {
  margin-top: 0;
}

/* --- Login Box --- */
.login-box {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: center;
  margin: 10vh auto 0;
  max-width: 400px;
}
.login-box h1 {
  color: var(--primary-color);
}
.login-box input {
  width: 100%;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}
.login-box button {
  width: 100%;
  padding: 0.8rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
.login-box button:hover {
  background: var(--primary-hover);
}
.login-box .error {
  color: var(--status-alarm);
  margin-top: 1rem;
}

/* --- Headers --- */
header {
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  height: 60px; /* Optional: Definierte Höhe für Berechnungen */
  box-sizing: border-box;
}

header.dashboard {
  background: var(--primary-color);
}
header.admin {
  background: var(--status-alarm);
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

/* Header Navigation Links */
header.dashboard a {
  color: white;
  padding: 0.5rem 1rem;
}
header.dashboard a.active,
header.dashboard a:hover {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-export-link {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  color: white;
  font-weight: 500;
  transition: background 0.2s;
}
.header-export-link:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  background: #fff;
  padding: 0.75rem 2rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 50px; /* Ca. Höhe für Berechnungen */
  box-sizing: border-box;
}
.breadcrumbs a {
  color: var(--primary-color);
  font-weight: 500;
}
.breadcrumbs a:hover {
  text-decoration: underline;
}
.breadcrumbs .separator {
  color: #ccc;
  font-size: 0.8rem;
}
.breadcrumbs .current {
  color: var(--text-color);
  font-weight: 600;
}

/* --- Dropdown Menus --- */
.header-menu {
  position: relative;
}
.menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.menu-trigger:hover {
  background: rgba(255, 255, 255, 0.25);
}
.menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  padding: 0.5rem 0;
  display: none;
  z-index: 50;
}
.header-menu:hover .menu-dropdown,
.header-menu:focus-within .menu-dropdown {
  display: flex;
  flex-direction: column;
}
.menu-dropdown a {
  color: var(--text-color) !important;
  padding: 0.5rem 1rem;
  display: block;
}
.menu-dropdown a:hover {
  background: var(--bg-color);
  color: var(--primary-color) !important;
}

/* --- Admin Navigation Bar --- */
nav.admin-nav {
  background: #333;
  padding: 0.5rem 2rem;
}
nav.admin-nav a {
  color: white;
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  border-radius: 4px;
}
nav.admin-nav a:hover,
nav.admin-nav a.active {
  background-color: #555;
}

/* --- Layout: Admin Only --- */
/* (Dashboard Layout wurde in dashboard.css ausgelagert) */
main {
  /* Standard Padding für Admin-Seiten. Dashboard überschreibt dies via Wrapper */
  padding: 1.5rem; 
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
}

/* --- Event Log Items (Content Styling) --- */
#event-log-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#event-log-container .event-item {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.65rem;
}

#event-log-container .event-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

#event-log-container .event-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
}

#event-log-container .event-site {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2933;
  display: block;
  margin-top: 0.05rem;
}

#event-log-container .event-component {
  font-weight: 500;
  color: var(--text-muted);
}

#event-log-container .event-error {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--status-alarm);
  display: block;
  margin-top: 0.2rem;
}

#event-log-container .event-item--resolved .event-error {
  text-decoration: line-through;
  color: var(--text-muted);
}

#event-log-container .event-resolved-time {
  font-size: 0.8rem;
  color: var(--status-ok);
  display: block;
  margin-top: 0.15rem;
}

/* --- Generic Cards (Admin & Fallback) --- */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}
.card h2 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.25rem;
}
.card-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

/* --- Pump Items (List Styling) --- */
.pump-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}
.pump-item:last-child {
  border-bottom: none;
}
.pump-simple-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pump-name {
  font-weight: bold;
  font-size: 1.1rem;
}
.pump-id-small {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.pump-fill-level {
  font-weight: 600;
  color: var(--primary-color);
}
.device-type-pill {
  background: #d9d9d9;
  color: #004a80;
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}
.device-type-pill.pump {
  background: #ddf5ff;
  color: #004a80;
}
.device-type-pill.meter {
  background-color: #d1e7dd;
  color: #0f5132;
}

/* Status Indicators */
.pump-status-row {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}
.status-dot {
  height: 10px;
  width: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.status-ok { background-color: var(--status-ok); }
.status-manual { background-color: var(--status-manual); }
.status-off { background-color: var(--status-off); }
.status-alarm { background-color: var(--status-alarm); }

/* --- Detail Page --- */
.detail-meta {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.detail-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 1.25rem;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.stat-row:last-child {
  border-bottom: none;
}
.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 600; }

/* --- Forms & Tables (Admin) --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}
th {
  background: #fafafa;
  font-weight: 600;
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  margin: 0;
  width: auto;
}
.notifications-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.notifications-channel {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
  background: #fff;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.notifications-channel input {
  margin: 0;
}
.notifications-channel:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px rgba(0, 90, 156, 0.15);
}
.notifications-channel.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
  border-color: #e5e7eb;
  box-shadow: none;
}
.notifications-channel.is-disabled:hover {
  border-color: #e5e7eb;
  box-shadow: none;
}

button {
  padding: 0.7rem 1.2rem;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.95rem;
}
button:hover {
  background: var(--primary-hover);
}
.btn-delete {
  background: var(--status-alarm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.feedback {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  background: #d4edda;
  color: #155724;
}
.feedback.error {
  background: #f8d7da;
  color: #721c24;
}

/* --- Index / Device Type Grid --- */

.device-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}
.type-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  position: relative;
  overflow: hidden;
}
.type-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  border-color: var(--primary-color);
}
.type-card-icon {
  width: 48px;
  height: 48px;
  background: #e7eef8;
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.type-card-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-color);
  font-weight: 600;
}
.type-card-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}
.type-card-arrow {
  color: var(--text-muted);
  font-weight: bold;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.2s;
}
.type-card:hover .type-card-arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--primary-color);
}


/* --- Responsive Media Queries --- */
@media (max-width: 1024px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    height: auto; /* Erlaubt wachsen auf Mobile */
  }
  .header-actions {
    justify-content: space-between;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
