/*
Theme Name: Baltic Clean
Theme URI: https://example.local/baltic-clean
Author: Baltic App
Author URI: https://example.local
Description: Clean WordPress dashboard theme for Baltic table billing with read-only API endpoints.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
Text Domain: baltic-clean
*/

:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --line: #dce6ee;
  --text: #17212b;
  --muted: #657383;
  --faint: #8fa0ad;
  --blue: #2563eb;
  --blue-dark: #123b8f;
  --cyan: #0f9fb3;
  --green: #107a4a;
  --amber: #c27a11;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(28, 45, 64, 0.12);
  --shadow-soft: 0 8px 24px rgba(28, 45, 64, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 36rem),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 34rem);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.baltic-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.baltic-brand,
.baltic-topbar,
.baltic-nav {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(220, 230, 238, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.baltic-brand {
  display: flex;
  align-items: center;
  min-height: 72px;
  border-radius: 18px;
  padding: 0 20px;
  color: var(--blue);
  font-size: 23px;
  font-weight: 900;
}

.baltic-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  border-radius: 18px;
  padding: 0 26px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.baltic-nav {
  grid-row: 2;
  border-radius: 22px;
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 18px;
}

.baltic-nav-label {
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
}

.baltic-nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 13px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.baltic-nav-button svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.baltic-nav-button.is-active {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
}

.baltic-main {
  grid-row: 2;
  min-width: 0;
}

.baltic-view-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  padding: 0 4px 18px;
  background: transparent;
  border: 0;
}

.baltic-view-title {
  margin: 0;
  font-size: 40px;
  line-height: 1;
  font-weight: 900;
}

.baltic-view {
  display: none;
  padding: 0 0 24px;
}

.baltic-view.is-active {
  display: block;
}

.baltic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.table-card,
.history-panel,
.metric-card,
.filter-panel,
.api-panel {
  background: var(--panel);
  border: 1px solid rgba(220, 230, 238, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.table-card {
  min-height: 260px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 22px;
  overflow: hidden;
}

.table-card.is-running {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.97), rgba(15, 159, 179, 0.94)),
    var(--blue);
  border-color: transparent;
  color: #fff;
}

.table-status {
  color: var(--faint);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.table-card.is-running .table-status,
.table-card.is-running .table-rate {
  color: #fff;
}

.table-name {
  margin: 14px 0 0;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 900;
}

.table-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 20px;
}

.table-rate,
.table-time,
.table-cost {
  font-weight: 800;
}

.table-rate {
  width: 100%;
  color: var(--faint);
  text-align: left;
  font-size: 24px;
}

.table-time {
  color: #c9ffdc;
  font-size: 34px;
}

.table-cost {
  font-size: 28px;
}

.table-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  background: var(--text);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.button.dark {
  background: rgba(18, 59, 143, 0.76);
}

.history-grid {
  display: block;
}

.history-panel {
  padding: 18px;
}

.history-shell {
  touch-action: pan-y;
}

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.history-kicker {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.history-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.table-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.table-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.table-switch button.is-active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.history-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.history-table th {
  padding: 11px 14px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.history-table th:first-child {
  border-radius: 12px 0 0 12px;
}

.history-table th:last-child {
  border-radius: 0 12px 12px 0;
  text-align: right;
}

.history-row td {
  background: #fff;
  border-top: 1px solid #edf0f3;
  border-bottom: 1px solid #edf0f3;
  padding: 14px;
  font-size: 15px;
}

.history-row td:first-child {
  border-left: 1px solid #edf0f3;
  border-radius: 12px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.history-row td:last-child {
  border-right: 1px solid #edf0f3;
  border-radius: 0 12px 12px 0;
  text-align: right;
}

.history-row.is-running {
  color: #fff;
}

.history-row.is-running td {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-color: transparent;
}

.history-hint {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}

.history-hint span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #c9d5df;
}

.history-hint span.is-active {
  width: 24px;
  background: var(--blue);
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.filter-panel,
.api-panel {
  padding: 20px;
}

.metric-label {
  color: var(--faint);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  margin: 12px 0 6px;
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
}

.metric-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.filter-button {
  min-height: 44px;
  border: 1px solid #dce2e8;
  border-radius: 999px;
  padding: 0 16px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.filter-button.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.api-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.api-list code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 12px;
  background: #f0f4f9;
  padding: 12px;
  color: var(--blue-dark);
}

.empty-state {
  color: var(--muted);
  font-weight: 700;
  padding: 14px 0;
}

@media (max-width: 760px) {
  .baltic-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    gap: 12px;
    padding: 12px;
    padding-bottom: 96px;
  }

  .baltic-brand,
  .baltic-topbar,
  .baltic-nav {
    border-radius: 18px;
  }

  .baltic-brand,
  .baltic-topbar {
    min-height: auto;
  }

  .baltic-brand {
    padding: 16px;
    font-size: 22px;
  }

  .baltic-topbar {
    display: none;
  }

  .baltic-nav {
    position: fixed;
    z-index: 20;
    left: 12px;
    right: 12px;
    bottom: 12px;
    top: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .baltic-nav-label {
    display: none;
  }

  .baltic-nav-button {
    margin: 0;
    justify-content: center;
    padding: 12px 8px;
    font-size: 13px;
    flex-direction: column;
    gap: 4px;
  }

  .baltic-nav-button svg {
    width: 20px;
    height: 20px;
  }

  .baltic-main {
    grid-column: 1;
    grid-row: 3;
  }

  .baltic-view-header {
    min-height: auto;
    padding: 8px 2px 16px;
  }

  .baltic-view-title {
    font-size: 34px;
  }

  .baltic-view {
    padding: 0;
  }

  .baltic-grid,
  .stats-cards {
    grid-template-columns: 1fr;
  }

  .table-card,
  .history-panel,
  .metric-card,
  .filter-panel,
  .api-panel {
    border-radius: 18px;
  }

  .table-name {
    font-size: 32px;
  }

  .table-time {
    font-size: 31px;
  }

  .table-cost {
    font-size: 25px;
  }

  .metric-value {
    font-size: 34px;
  }

  .history-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-switch {
    width: 100%;
  }

  .history-table {
    min-width: 620px;
  }

  .history-table th,
  .history-row td {
    padding: 12px;
  }

  .history-table-wrap {
    margin: 0 -4px;
  }
}
