:root {
  --gold: #f5c518;
  --gold-bright: #ffdc61;
  --panel: rgba(10, 6, 10, 0.82);
  --panel-border: rgba(245, 197, 24, 0.25);
  --text: #f2f2f2;
  --text-dim: #c9c2b8;
  --danger: #ff6b6b;
  --ok: #6bffa0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--text);
}

/* Full-bleed dragon background, fixed so it doesn't scroll away under
   long pages - the artwork stays put, content scrolls over it. */
body {
  background-image:
    linear-gradient(180deg, rgba(10,4,8,0.35) 0%, rgba(10,4,8,0.15) 40%, rgba(6,3,6,0.55) 100%),
    url('/static/img/dragon-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0));
}

.callsign {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  text-shadow: 0 2px 10px rgba(0,0,0,0.9), 0 0 22px rgba(245,197,24,0.35);
  text-decoration: none;
}

.callsign .subtitle {
  display: block;
  font-size: 13px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-shadow: 0 2px 6px rgba(0,0,0,0.9);
  font-family: Arial, sans-serif;
  font-weight: normal;
  text-transform: uppercase;
}

/* Nav dropdown - dark panel so it stays legible regardless of what
   part of the busy background is behind it. */
.nav-wrap {
  position: relative;
}

.nav-wrap summary {
  cursor: pointer;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--gold-bright);
  padding: 10px 18px;
  border-radius: 10px;
  font-family: Arial, sans-serif;
  font-weight: bold;
  letter-spacing: 0.05em;
}
.nav-wrap summary::-webkit-details-marker { display: none; }

.nav-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.7);
  padding: 8px;
  z-index: 30;
}

.nav-link {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: Arial, sans-serif;
  font-size: 14px;
}
.nav-link:hover { background: rgba(245,197,24,0.12); }
.nav-link-current {
  background: linear-gradient(var(--gold-bright), var(--gold));
  color: #1a1207;
  font-weight: 700;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}

/* Content cards: the important part of the "don't blend in" spec -
   a solid dark panel behind anything with real text/data, so the
   dragon stays fully visible in open space but never fights with
   content for readability. */
.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 22px 26px;
  margin-bottom: 22px;
  backdrop-filter: blur(2px);
}

.card h2 {
  margin-top: 0;
  font-family: Arial, sans-serif;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
}

p, li, td, th, label {
  font-family: Arial, sans-serif;
  color: var(--text);
}

a { color: var(--gold-bright); }

.button {
  display: inline-block;
  background: linear-gradient(var(--gold-bright), var(--gold));
  color: #1a1207;
  border: none;
  padding: 11px 20px;
  border-radius: 10px;
  font-family: Arial, sans-serif;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
}
.button:hover { filter: brightness(1.08); }

.button.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.control-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  width: 100%;
}

.status-ok { color: var(--ok); font-weight: bold; }
.status-bad { color: var(--danger); font-weight: bold; }

/* Login page: same theme, centered, no nav */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 40px 44px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.login-card h1 {
  text-align: center;
  color: var(--gold-bright);
  font-size: 30px;
  margin-top: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.9);
}

.login-error {
  background: rgba(255,107,107,0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--panel-border); }

/* ==========================================================
   W7CTY v7 Dashboard
   ========================================================== */

.dashboard-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-stat {
  margin-bottom: 0;
  min-height: 118px;
}

.stat-label {
  font-family: Arial, sans-serif;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.stat-value {
  font-family: Arial, sans-serif;
  margin-top: 13px;
  font-size: 21px;
  font-weight: 700;
}

.stat-sub {
  font-family: Arial, sans-serif;
  color: var(--text-dim);
  margin-top: 5px;
  font-size: 13px;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 22px;
  align-items: start;
}

.next-event-name {
  font-family: Arial, sans-serif;
  font-size: 25px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(140px, 2fr);
  gap: 0;
  font-family: Arial, sans-serif;
}

.detail-grid > span,
.detail-grid > strong {
  padding: 9px 4px;
  border-bottom: 1px solid var(--panel-border);
}

.detail-grid > span {
  color: var(--text-dim);
}

.detail-grid > strong {
  text-align: right;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.favorite-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  background: rgba(0,0,0,.25);
  font-family: Arial, sans-serif;
}

.favorite-card strong {
  display: block;
  color: var(--gold-bright);
  margin-bottom: 7px;
}

.favorite-card span {
  color: var(--text);
  font-weight: 700;
}

.activity-list {
  font-family: monospace;
  font-size: 12px;
}

.activity-line {
  padding: 8px 5px;
  border-bottom: 1px solid var(--panel-border);
  overflow-wrap: anywhere;
}

.empty-state {
  font-family: Arial, sans-serif;
  color: var(--text-dim);
  padding: 10px 0;
}

@media (max-width: 900px) {
  .dashboard-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .dashboard-status-grid {
    grid-template-columns: 1fr;
  }

  .favorites-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================
   W7CTY v7 Automation
   ========================================================== */

.automation-note {
  font-family: Arial, sans-serif;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.schedule-list {
  display: grid;
  gap: 12px;
}

.schedule-event {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(0,0,0,.30);
  overflow: hidden;
}

.schedule-event > summary {
  display: grid;
  grid-template-columns: 1.1fr 2fr auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  padding: 15px;
  font-family: Arial, sans-serif;
}

.schedule-name {
  color: var(--gold-bright);
  font-weight: 700;
}

.schedule-summary {
  color: var(--text-dim);
  font-size: 13px;
}

.schedule-state {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.schedule-state.enabled,
.status-ok {
  color: #7ee787;
}

.schedule-state.paused,
.status-bad {
  color: #ff8b8b;
}

.schedule-body {
  border-top: 1px solid var(--panel-border);
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 15px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: Arial, sans-serif;
  color: var(--text-dim);
  font-size: 13px;
}

.form-grid input,
.form-grid select {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: rgba(0,0,0,.55);
  color: var(--text);
}

.form-grid small {
  line-height: 1.4;
  color: var(--text-dim);
}

.wide-field {
  grid-column: 1 / -1;
}

.schedule-actions {
  margin-top: 16px;
}

.schedule-actions button,
.secondary-button {
  padding: 10px 16px;
  border: 1px solid var(--gold);
  border-radius: 7px;
  background: var(--gold);
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

.toggle-form {
  display: inline-block;
  margin-top: 10px;
}

.secondary-button {
  background: transparent;
  color: var(--gold-bright);
}

.event-id {
  margin-top: 15px;
  color: var(--text-dim);
  font-family: monospace;
  font-size: 11px;
}

.automation-log {
  max-height: 420px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(0,0,0,.55);
  font-family: monospace;
  font-size: 12px;
}

.automation-log > div {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  overflow-wrap: anywhere;
}

.log-toolbar {
  margin-bottom: 12px;
  color: var(--text-dim);
  font-family: Arial, sans-serif;
  font-size: 13px;
}

@media (max-width: 760px) {
  .schedule-event > summary {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }
}

/* ==========================================================
   W7CTY DTMF Reference
   ========================================================== */

.dtmf-intro,
.dtmf-note {
  font-family: Arial, sans-serif;
  color: var(--text-dim);
  line-height: 1.5;
}

.dtmf-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(0,0,0,.28);
}

.dtmf-grid {
  display: grid;
  gap: 9px;
}

.dtmf-row {
  display: grid;
  grid-template-columns: minmax(145px, .65fr) 2fr;
  align-items: center;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(0,0,0,.30);
}

.dtmf-code {
  font-family: monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-bright);
}

.dtmf-description {
  font-family: Arial, sans-serif;
  color: var(--text);
}

@media (max-width: 600px) {
  .dtmf-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

/* ==========================================================
   W7CTY FAVORITES CONTROLS
   ========================================================== */

.favorite-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.favorite-control-form {
    flex: 1;
    margin: 0;
}

.favorite-button {
    width: 100%;
    padding: 9px 8px;
    border-radius: 7px;
    border: 1px solid currentColor;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
}

.favorite-button:disabled {
    opacity: .55;
    cursor: wait;
}

.favorite-connect {
    background: #1d6f42;
    color: white;
}

.favorite-disconnect {
    background: #7a2525;
    color: white;
}

.favorite-result {
    margin-bottom: 14px;
    padding: 11px 14px;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-weight: 700;
}

.favorite-success {
    border: 1px solid #438b60;
}

.favorite-error {
    border: 1px solid #a84545;
}

@media (max-width: 600px) {
    .favorite-actions {
        flex-direction: column;
    }
}

/* W7CTY DTMF SEND CONTROL */

.dtmf-row {
    grid-template-columns: minmax(145px,.65fr) 2fr auto;
}

.dtmf-action {
    min-width: 80px;
}

.dtmf-send-form {
    margin: 0;
}

.dtmf-send-button {
    padding: 8px 14px;
    border: 1px solid var(--gold);
    border-radius: 7px;
    background: var(--gold);
    color: #111;
    font-weight: 700;
    cursor: pointer;
}

.dtmf-send-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .dtmf-row {
        grid-template-columns: 1fr;
    }
}

/* W7CTY DTMF VALUE INPUT */

.dtmf-send-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dtmf-value-input {
    width: 130px;
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid var(--panel-border);
    background: rgba(0,0,0,.35);
    color: var(--text);
    font-weight: 600;
}

.dtmf-value-input::placeholder {
    color: var(--text-dim);
}

@media (max-width: 600px) {
    .dtmf-send-form {
        width: 100%;
    }

    .dtmf-value-input {
        flex: 1;
        width: auto;
    }
}
