/* ============================================================
   Nebraska School Debt Tracker — Standalone Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  background: #f0f2f5;
  color: #333;
}

/* ── Login ──────────────────────────────────────────────────── */
#loginScreen {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a3a6e 0%, #2d6a9f 100%);
}

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 24px;
}

.login-box {
  background: #fff;
  border-radius: 10px;
  padding: 40px 36px;
  width: min(360px, 100%);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  text-align: center;
  margin: 0 auto;
}

.login-logo {
  width: 90px;
  height: auto;
  margin-bottom: 14px;
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 24px;
  color: #1a3a6e;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow:
    1px 0 #fff,
    -1px 0 #fff,
    0 1px #fff,
    0 -1px #fff,
    1px 1px #fff,
    -1px -1px #fff,
    1px -1px #fff,
    -1px 1px #fff,
    1.8px 0 #cc0000,
    -1.8px 0 #cc0000,
    0 1.8px #cc0000,
    0 -1.8px #cc0000,
    1.8px 1.8px #cc0000,
    -1.8px -1.8px #cc0000,
    1.8px -1.8px #cc0000,
    -1.8px 1.8px #cc0000;
}

.login-subtitle {
  color: #666;
  margin: 0 0 24px;
  font-size: 13px;
}

.login-box input[type="email"],
.login-box input[type="text"],
.login-box input[type="password"] {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 12px;
  color: #333;
  background: #fff;
  font-family: inherit;
  line-height: 1.2;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.login-box button {
  width: 100%;
  padding: 11px;
  background: #1a3a6e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:hover { background: #14305a; }

.error-msg {
  color: #c0392b;
  font-size: 13px;
  margin: 8px 0 0;
  min-height: 18px;
}

.login-footer {
  margin-top: 24px;
  font-size: 11px;
  color: #999;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  color: #1a3a6e;
  padding: 10px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-logo {
  height: 52px;
  width: auto;
  flex-shrink: 0;
}

.header-titles {
  display: flex;
  flex-direction: column;
}

.app-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: #1a3a6e;
}

.app-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: #cc0000;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  max-width: 180px;
  color: #1a3a6e;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-status {
  font-size: 12px;
  opacity: 0.9;
  max-width: 280px;
}

.btn-header-secondary {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid #1a3a6e;
  color: #1a3a6e;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.btn-header-secondary:hover { background: #f0f4fa; }

.btn-user-guide {
  padding: 7px 16px;
  background: #1a3a6e;
  border: 1px solid #1a3a6e;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-user-guide:hover { background: #14305a; border-color: #14305a; }

.btn-support {
  padding: 7px 16px;
  background: #fff;
  border: 1px solid #1a3a6e;
  color: #1a3a6e;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.btn-support:hover { background: #1a3a6e; color: #fff; }

/* ── Action Bar ─────────────────────────────────────────────── */
.district-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: #1a3a6e;
}

.district-label {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.district-value {
  flex: 1;
  max-width: 480px;
  padding: 8px 12px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  color: #fff;
  min-height: 36px;
}

.district-state { max-width: 180px; }
.district-id { max-width: 160px; }

.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin: 20px 24px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  color: #1a3a6e;
  border-bottom: 2px solid #e8eef5;
  padding-bottom: 10px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e8eef5;
}

.section-heading h3 {
  border-bottom: 0;
  margin-bottom: 0;
}

.section-heading-compact {
  margin-top: 24px;
}

.admin-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-panel {
  border-color: #c9d8e8;
}

.admin-options {
  align-items: center;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  font-weight: 600;
  color: #444;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.inline-status {
  min-height: 18px;
  margin: 2px 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.inline-status.success { color: #1a5c2e; }
.inline-status.error { color: #c0392b; }
.inline-status.info { color: #1a3a6e; }

.message-tab,
#adminBtn,
#supportBtn {
  position: relative;
}

.has-message-marker::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 10px;
  height: 10px;
  background: #c0392b;
  border: 2px solid #fff;
  border-radius: 50%;
}

.message-badge {
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
}

.admin-messages {
  margin-top: 24px;
}

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

.message-empty {
  padding: 18px;
  border: 1px dashed #c9d8e8;
  border-radius: 6px;
  color: #777;
  text-align: center;
  background: #fafbfd;
}

.message-card {
  border: 1px solid #dce5f0;
  border-left: 4px solid #2d6a9f;
  border-radius: 6px;
  padding: 14px;
  background: #fff;
}

.message-card.completed {
  border-left-color: #7f8c8d;
  background: #fafafa;
}

.message-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.message-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #1a3a6e;
}

.message-card-header p {
  margin: 0;
  font-size: 12px;
  color: #666;
}

.message-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.message-status.open {
  background: #fdecea;
  color: #c0392b;
}

.message-status.completed {
  background: #e6f4ea;
  color: #1a5c2e;
}

.message-body {
  margin: 12px 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.message-details {
  margin-bottom: 12px;
  color: #666;
  font-size: 12px;
}

.message-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
}

.form-group input,
.form-group select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2d6a9f;
  box-shadow: 0 0 0 2px rgba(45,106,159,0.15);
}

.form-actions {
  justify-content: flex-end;
  flex-direction: row !important;
  align-items: flex-end;
  gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  padding: 8px 18px;
  background: #1a3a6e;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary:hover { background: #14305a; }

.btn-secondary {
  padding: 8px 16px;
  background: #f5f6fa;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.btn-secondary:hover { background: #e8eaf0; }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  margin: 0 3px;
}

.btn-sm.btn-secondary {
  background: #f0f2f8;
  color: #333;
  border: 1px solid #ccc;
}

.btn-sm.btn-secondary:hover { background: #e0e4ef; }

.btn-sm.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-sm.btn-danger:hover { background: #c0392b; }

/* ── Data Table ─────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: #1a3a6e;
  color: #fff;
}

.data-table th {
  padding: 11px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8eaf0;
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #f5f8fd; }
.data-table tbody tr:nth-child(even) { background: #fafbfd; }
.data-table tbody tr:nth-child(even):hover { background: #f0f4fa; }

.empty-row td {
  text-align: center;
  color: #999;
  padding: 28px;
  font-style: italic;
}

/* Schedule input */
.schedule-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  text-align: right;
  font-size: 13px;
}

.schedule-input:focus {
  outline: none;
  border-color: #2d6a9f;
}

/* ── Summary ─────────────────────────────────────────────────── */
.summary-card { background: #f5f8fd; }

.summary-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.summary-item {
  flex: 1;
  min-width: 180px;
  background: #fff;
  border: 1px solid #dce5f0;
  border-radius: 6px;
  padding: 14px 18px;
}

.summary-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.summary-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #1a3a6e;
}

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 30px 16px;
}

.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  margin: auto;
}

.modal-wide { max-width: 860px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: #1a3a6e;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.modal-close:hover { color: #333; }

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.profile-readonly {
  display: grid;
  gap: 7px;
  padding: 12px;
  background: #f5f8fd;
  border: 1px solid #dce5f0;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.modal-divider {
  border: 0;
  border-top: 1px solid #e0e0e0;
  margin: 16px 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-header { flex-direction: column; gap: 12px; text-align: center; padding: 14px; }
  .header-left { flex-direction: column; align-items: center; gap: 10px; }
  .navbar-logo { height: 44px; }
  .header-right { flex-wrap: wrap; justify-content: center; }
  .district-bar { flex-direction: column; align-items: stretch; }
  .district-value { max-width: none; }
  .action-bar { flex-wrap: wrap; }
  .form-row { flex-direction: column; }
  .form-group { min-width: 100%; }
  .form-actions { flex-direction: row !important; justify-content: flex-end; }
  .card { margin: 12px; padding: 16px; }
  .summary-grid { flex-direction: column; }
}

.app-footer {
  text-align: center;
  padding: 16px 24px;
  font-size: 12px;
  color: #888;
  border-top: 1px solid #e0e0e0;
  margin-top: 10px;
  background: #fff;
}

@media print {
  .app-header, .action-bar, .app-footer { display: none; }
  .card { box-shadow: none; border: none; margin: 0; }
}
