/*
 * File: public/styles.css
 *
 * This is the base stylesheet for the application, defining root variables
 * and global styles. No changes were needed here for the clipping fix, as
 * the issue was addressed in the inline styles of report_view.html.
 *
 * Root variables define the color scheme and shadows for a consistent dark theme.
 * Global resets ensure box-sizing and full-height layout.
 */

:root{
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212a;
  --text: #e7ebf3;
  --muted: #a9b1c3;
  --accent: #71c7ec;
  --accent-2:#50e3c2;
  --ok: #61d345;
  --warn:#f6c344;
  --bad: #ff6464;
  --card:#151922;
  --border:#232838;
  --shadow: 0 10px 24px rgba(0,0,0,.35);
}

/*
 * Global box-sizing reset for consistent padding/border calculations.
 */
*{ box-sizing:border-box; }

/*
 * Full-height setup for html/body to enable grid layouts that fill the viewport.
 */
html,body{ height:100%; margin:0; }

/*
 * Base body styles: font stack for cross-platform consistency, colors, and background.
 */
body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color:var(--text);
  background: var(--bg);
}

/* Layout */
/*
 * Grid layout for sidebar and main content.
 */
.layout{
  display:grid;
  grid-template-columns: 300px 1fr;
  min-height:100vh;
}

/*
 * Sidebar padding and gradient background.
 */
.sidebar{
  padding:18px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border-right:1px solid var(--border);
}

/*
 * Main content area padding.
 */
.main{
  padding:22px 28px 48px;
}

/* Sidebar */
/*
 * Brand title and subtitle styles.
 */
.brand{ margin-bottom:18px; }
.brand-title{ font-weight:700; letter-spacing:.4px; }
.brand-sub{ color:var(--muted); font-size:.9rem; margin-top:2px; }

/*
 * Panel sections in sidebar.
 */
.panel{ margin-top:18px; }
.panel h3{ margin:0 0 10px; font-size:.95rem; color:var(--muted); letter-spacing:.3px; }

/*
 * Device list in sidebar: flexbox items with active state.
 */
.device-list{ list-style:none; margin:0; padding:0; }
.device-list li{
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 10px; margin-bottom:8px; border:1px solid var(--border);
  background: var(--card); border-radius:10px; cursor:pointer;
}
.device-list li.active{ outline:2px solid var(--accent); }
.device-id{ font-weight:600; }
.device-meta{ color:var(--muted); font-size:.85rem; }

/*
 * Action buttons grid.
 */
.actions{ display:grid; gap:10px; }

/*
 * Button base styles with hover effect.
 */
.btn{
  padding:10px 12px; border-radius:10px; border:1px solid var(--border);
  background:var(--panel-2); color:var(--text); cursor:pointer;
}
.btn:hover{ filter:brightness(1.08); }
.btn-ghost{ background:transparent; }
.btn-link{ background:transparent; text-align:left; color:var(--accent); border:none; padding:0; }

/* Main area */
/*
 * Topbar for title and connection status.
 */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:14px; padding-bottom:14px; border-bottom:1px solid var(--border);
}
.title{ font-size:1.15rem; font-weight:600; }
.connected{ color:var(--muted); }

/*
 * Section titles.
 */
.section-title{ margin:14px 0; font-size:1rem; color:var(--muted); }

/*
 * Grid for card layouts.
 */
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap:14px;
}

/*
 * Card component styles.
 */
.card{
  border:1px solid var(--border); background:var(--card);
  border-radius:14px; padding:14px; box-shadow: var(--shadow);
}
.card h4{ margin:0 0 6px; }
.kv{ display:flex; justify-content:space-between; margin:6px 0; color:var(--muted); }
.k{ color:var(--muted); } .v{ color:var(--text); font-weight:600; }

/*
 * Badge styles for status indicators.
 */
.badge{ display:inline-block; padding:2px 8px; border-radius:999px; font-size:.8rem; }
.badge.ok{ background:rgba(97,211,69,.15); color:var(--ok); border:1px solid rgba(97,211,69,.35);}
.badge.warn{ background:rgba(246,195,68,.15); color:var(--warn); border:1px solid rgba(246,195,68,.35);}
.badge.bad{ background:rgba(255,100,100,.15); color:var(--bad); border:1px solid rgba(255,100,100,.35);}

.details .card.empty{ display:flex; align-items:center; justify-content:center; min-height:140px; color:var(--muted); }

/* Toast */
/*
 * Toast notification styles with animation.
 */
.toast{
  position:fixed; bottom:18px; right:18px; padding:10px 14px; border-radius:10px;
  background:var(--panel-2); color:var(--text); border:1px solid var(--border);
  box-shadow: var(--shadow); opacity:0; transform: translateY(8px); transition: .2s;
}
.toast.show{ opacity:1; transform: translateY(0); }

/* --- Input styling for dark theme --- */
/*
 * Input and select styles matching the theme.
 */
input[type="number"], input[type="text"], select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(113,199,236,.15);
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* Inputs visible on dark backgrounds */
/*
 * Repeated input styles (possibly for override).
 */
input[type="number"], input[type="text"], select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(113,199,236,.15);
}
.section-title { margin-top: 12px; font-weight: 600; opacity: .9; }

/* Mobile responsiveness */
/*
 * Media query for smaller screens: stack layout, adjust paddings, etc.
 */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;  /* Stack sidebar on top */
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
  .main {
    padding: 16px 12px;
  }
  .filter-bar {
    flex-direction: column;  /* Stack filters vertically */
  }
  .data-table {
    display: block;
    overflow-x: auto;  /* Horizontal scroll for wide tables */
    white-space: nowrap;
  }
  .data-table th, .data-table td {
    padding: 10px;
    font-size: 14px;  /* Slightly smaller but readable */
  }
  .btn, .filter-input {
    font-size: 16px;  /* Bigger touch targets */
    padding: 12px;
  }
  .pagination {
    flex-direction: column;
    gap: 12px;
  }
}