/*
 * MyLight static demo - stylesheet
 * Visual identity reproduced from the original C# project (Utilities/Ui.cs):
 *   Background  rgb(13, 22, 37)   -> #0D1625
 *   Panel       rgb(22, 34, 52)   -> #162234
 *   PanelLight  rgb(29, 44, 64)   -> #1D2C40
 *   Accent      rgb(41, 211, 174) -> #29D3AE
 *   Text        rgb(237, 244, 250)-> #EDF4FA
 *   Muted       rgb(151, 169, 188)-> #97A9BC
 *   Sidebar     rgb(10, 18, 31)   -> #0A121F
 *   Row select  rgb(36, 75, 82)   -> #244B52
 *   Button hover rgb(42, 61, 83)   -> #2A3D53
 * Font family: Segoe UI (as in the WinForms application).
 */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #0D1625;
  color: #EDF4FA;
  font-family: "Segoe UI", "Segoe UI Variable", Tahoma, Geneva, Verdana, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ================= LOGIN (LoginForm.cs) ================= */

.login-screen {
  display: flex;
  min-height: 100vh;
  flex-direction: row;
}

.login-left {
  flex: 0 0 53%;
  background: #0D1625;
  padding: 55px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.login-left .brand {
  color: #29D3AE;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 10px;
}

.login-left .headline {
  color: #EDF4FA;
  font-size: 37px;
  line-height: 1.22;
  font-weight: 700;
  margin: 62px 0 0 0;
}

.login-left .sub {
  color: #97A9BC;
  font-size: 14.5px;
  line-height: 1.55;
  margin: 26px 0 0 0;
}

.login-left .login-footer {
  color: #97A9BC;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-top: auto;
}

.login-right {
  flex: 0 0 47%;
  background: #162234;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

.login-title {
  color: #EDF4FA;
  font-size: 30px;
  font-weight: 700;
  margin: 30px 0 8px 2px;
}

.login-desc {
  color: #97A9BC;
  font-size: 14px;
  margin: 0 0 34px 4px;
}

.field-label {
  display: block;
  color: #97A9BC;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin: 16px 0 6px 4px;
}

.text-input {
  width: 100%;
  max-width: 290px;
  height: 39px;
  padding: 0 10px;
  border: 1px solid #1D2C40;
  border-radius: 0;
  background: #1D2C40;
  color: #EDF4FA;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.text-input:focus {
  border-color: #29D3AE;
}

.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.btn-accent {
  background: #29D3AE;
  color: #0D1625;
}

.btn-accent:hover, .btn-accent:focus-visible { background: #35E2BB; }

.btn-signin {
  width: 290px;
  height: 44px;
  margin-top: 26px;
}

.login-message {
  color: #97A9BC;
  font-size: 12.5px;
  margin: 14px 0 0 4px;
  min-height: 18px;
}

.login-message.error { color: salmon; }

.login-disclosure {
  color: #97A9BC;
  opacity: 0.75;
  font-size: 11px;
  line-height: 1.5;
  max-width: 290px;
  margin: 26px 0 0 4px;
}

/* ================= DASHBOARD (MainForm.cs) ================= */

.app-screen {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */

.sidebar {
  flex: 0 0 225px;
  background: #0A121F;
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-head .sidebar-logo {
  color: #29D3AE;
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0 8px 0;
}

.sidebar-head .sidebar-sub {
  color: #97A9BC;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.nav-section {
  color: #97A9BC;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin: 40px 0 10px 6px;
}

.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #EDF4FA;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 12px 14px;
  margin: 4px 0;
  cursor: pointer;
}

.nav-btn:hover, .nav-btn:focus-visible { background: #2A3D53; }

.nav-btn-active {
  background: #1D2C40;
  color: #29D3AE;
}

.sidebar-user {
  margin-top: auto;
  padding: 0 6px 14px 6px;
}

.sidebar-account-label {
  color: #97A9BC;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.sidebar-owner {
  color: #EDF4FA;
  font-size: 13.5px;
  font-weight: 700;
  margin-top: 6px;
  overflow-wrap: break-word;
}

.sidebar-code {
  color: #29D3AE;
  font-size: 12.5px;
  margin-top: 4px;
}

.nav-btn-logout {
  background: #1D2C40;
  color: #EDF4FA;
  padding: 11px 14px;
}

.nav-btn-logout:hover, .nav-btn-logout:focus-visible { background: #2A3D53; }

/* --- Content --- */

.content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 18px 28px;
  background: #0D1625;
  display: flex;
  flex-direction: column;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.page-title {
  color: #EDF4FA;
  font-size: 30px;
  font-weight: 700;
  margin: 0;
}

.page-subtitle {
  color: #97A9BC;
  font-size: 13px;
  margin: 6px 0 0 2px;
}

.header-date {
  color: #97A9BC;
  font-size: 13px;
  text-align: right;
  padding-top: 10px;
  white-space: nowrap;
}

/* --- Filter panel --- */

.filter-panel {
  background: #162234;
  padding: 6px 12px 8px 12px;
  margin-bottom: 8px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  flex-wrap: wrap;
}

.filter-row .field-label { margin: 0 0 0 4px; }

.date-input {
  height: 32px;
  padding: 0 6px;
  border: 1px solid #1D2C40;
  background: #1D2C40;
  color: #EDF4FA;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  color-scheme: dark;
}

.date-input:focus { border-color: #29D3AE; }

.btn-filter {
  background: #1D2C40;
  color: #EDF4FA;
  height: 34px;
  padding: 0 16px;
}

.btn-filter:hover, .btn-filter:focus-visible { background: #2A3D53; }

.period-label {
  color: #97A9BC;
  font-size: 12px;
  padding: 4px 2px 4px 2px;
}

/* --- Metric cards --- */

.cards {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  margin-bottom: 12px;
}

.card {
  flex: 1 1 0;
  background: #162234;
  padding: 18px;
  min-width: 0;
}

.card-title {
  color: #97A9BC;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.card-value {
  color: #EDF4FA;
  font-size: 29px;
  font-weight: 700;
  margin-top: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-caption {
  color: #97A9BC;
  font-size: 11px;
  margin-top: 8px;
}

/* --- Panels: chart + history --- */

.panel {
  background: #162234;
  padding: 14px;
  margin-bottom: 12px;
}

.panel-title {
  color: #EDF4FA;
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 12px 0;
}

.chart-wrap {
  height: 270px;
  position: relative;
}

.chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- History table (DataGridView) --- */
/* The original WinForms grid sat in a fixed-height panel with its own scrollbar. */
.history-wrap {
  overflow-y: auto;
  max-height: 300px;
  border: 1px solid #1D2C40;
}

.history-wrap::-webkit-scrollbar { width: 10px; }
.history-wrap::-webkit-scrollbar-track { background: #0D1625; }
.history-wrap::-webkit-scrollbar-thumb { background: #1D2C40; }
.history-wrap::-webkit-scrollbar-thumb:hover { background: #2A3D53; }

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.usage-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.usage-table th {
  background: #1D2C40;
  color: #EDF4FA;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 2px solid #1D2C40;
}

.usage-table td {
  background: #162234;
  color: #EDF4FA;
  padding: 9px 12px;
  border-bottom: 1px solid #0D1625;
}

.usage-table tbody tr:nth-child(even) td { background: #1D2C40; }

.usage-table tbody tr {
  cursor: default;
}

.usage-table tbody tr:hover td,
.usage-table tbody tr.selected td {
  background: #244B52;
  color: #EDF4FA;
}

.table-empty {
  color: #97A9BC;
  padding: 22px 4px;
  font-size: 13.5px;
}

/* --- Status + footer --- */

.status-label {
  color: #97A9BC;
  font-size: 12px;
  min-height: 24px;
}

.app-footer {
  margin-top: auto;
  padding: 14px 0 4px 0;
  color: #97A9BC;
  opacity: 0.75;
  font-size: 11px;
  line-height: 1.5;
}

/* --- MessageBox modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-box {
  background: #162234;
  border: 1px solid #1D2C40;
  min-width: 320px;
  max-width: 420px;
  padding: 20px 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.modal-title {
  color: #EDF4FA;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-message {
  color: #EDF4FA;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-line;
}

.modal-ok {
  margin-top: 18px;
  width: 96px;
  height: 38px;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 900px) {
  /* Login: stack columns (welcome panel on top, form below) */
  .login-screen { flex-direction: column; }
  .login-left { flex: none; padding: 34px 26px 26px 26px; }
  .login-left .headline { font-size: 30px; margin-top: 30px; }
  .login-left .login-footer { margin-top: 34px; }
  .login-right { flex: none; padding: 30px 26px 40px 26px; min-height: 0; }
  .login-title { margin-top: 0; }
}

@media (max-width: 860px) {
  /* Dashboard: sidebar becomes a top bar */
  .app-screen { flex-direction: column; }
  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
    flex: none;
    width: 100%;
    padding: 12px 14px;
  }
  .sidebar-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .sidebar-head .sidebar-logo { font-size: 18px; margin: 0; }
  .sidebar-head .sidebar-sub { margin: 0; }
  .nav-section, .sidebar-user { display: none; }
  .nav-btn {
    width: auto;
    display: inline-block;
    padding: 9px 12px;
    margin: 6px 6px 0 0;
  }
  .sidebar .nav-btn-logout { margin-left: auto; }

  .content { padding: 18px 14px 14px 14px; }
  .content-header { flex-direction: column; }
  .header-date { padding-top: 0; text-align: left; }
  .cards { flex-direction: column; }
  .chart-wrap { height: 220px; }
}
