/* ================================================================
   VELAR HOLDING — Admin Panel Styles
   Colors: #071B2E bg · #0D2440 surface · #C5A880 accent
   Fonts : Plus Jakarta Sans (headings) · Inter (body)
   ================================================================ */

:root {
  --admin-bg:           #071B2E;
  --admin-surface:      #0D2440;
  --admin-surface-2:    #153A58;
  --admin-border:       rgba(255,255,255,0.08);
  --admin-border-hover: rgba(197,168,128,0.3);
  --admin-text:         #FAF9F6;
  --admin-text-muted:   #8FA0AE;
  --admin-accent:       #C5A880;
  --admin-accent-hover: #d4bc9b;
  --admin-danger:       #e84057;
  --admin-success:      #34d399;
  --admin-info:         #63b3ed;
  --admin-radius:       12px;
  --admin-transition:   0.25s cubic-bezier(0.16,1,0.3,1);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.admin-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(12,40,72,0.45), transparent 65%),
    var(--admin-bg);
}

.admin-login-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
  text-align: center;
}

.admin-login-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 20px;
  padding: 52px 40px 40px;
  box-shadow: 0 32px 72px rgba(0,0,0,0.5);
}

.admin-login-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
  background: rgba(197,168,128,0.1);
  border: 1px solid rgba(197,168,128,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-accent);
}

.admin-login-icon--locked {
  background: rgba(232,64,87,0.1);
  border-color: rgba(232,64,87,0.25);
  color: var(--admin-danger);
}

.admin-login-card h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 10px;
}

.admin-login-card > p {
  color: var(--admin-text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 28px;
}

.admin-form-group {
  text-align: left;
  margin-bottom: 20px;
}

.admin-form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--admin-text-muted);
  margin-bottom: 8px;
}

/* Input wrapper for password toggle */
.admin-input-wrap {
  position: relative;
}

.admin-form-group input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  color: var(--admin-text);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--admin-transition), box-shadow var(--admin-transition);
}

.admin-form-group input:focus {
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(197,168,128,0.12);
}

.admin-toggle-pw {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  transition: color var(--admin-transition);
}
.admin-toggle-pw:hover { color: var(--admin-accent); }

.admin-back-link {
  display: inline-block;
  margin-top: 22px;
  color: var(--admin-text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color var(--admin-transition);
}
.admin-back-link:hover { color: var(--admin-accent); }

.admin-login-footer {
  margin-top: 36px;
  font-size: 0.72rem;
  color: var(--admin-text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.admin-login-footer span { color: var(--admin-accent); font-weight: 700; }

/* ── ALERTS ─────────────────────────────────────────────────── */
.admin-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 20px;
  text-align: left;
}
.admin-alert svg { flex-shrink: 0; margin-top: 1px; }

.admin-alert-error {
  background: rgba(232,64,87,0.1);
  border: 1px solid rgba(232,64,87,0.3);
  color: var(--admin-danger);
}
.admin-alert-lockout {
  background: rgba(232,64,87,0.14);
  border-color: rgba(232,64,87,0.45);
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--admin-transition);
  line-height: 1;
}
.admin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.admin-btn-primary {
  width: 100%;
  background: var(--admin-accent);
  color: #0C2848;
  border-color: var(--admin-accent);
  margin-top: 4px;
}
.admin-btn-primary:hover {
  background: var(--admin-accent-hover);
  box-shadow: 0 8px 24px rgba(197,168,128,0.3);
  transform: translateY(-1px);
}

.admin-btn-ghost {
  background: transparent;
  border-color: var(--admin-border);
  color: var(--admin-text-muted);
}
.admin-btn-ghost:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.admin-btn-danger {
  background: rgba(232,64,87,0.1);
  border-color: rgba(232,64,87,0.25);
  color: var(--admin-danger);
}
.admin-btn-danger:hover {
  background: rgba(232,64,87,0.22);
  border-color: rgba(232,64,87,0.5);
}

.admin-btn-sm { padding: 7px 14px; font-size: 0.78rem; border-radius: 7px; }

/* ── DASHBOARD HEADER ────────────────────────────────────────── */
.admin-header {
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 200;
}

.admin-header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-velar    { color: var(--admin-accent); }
.brand-holding  { color: var(--admin-text); }

.admin-badge {
  background: var(--admin-accent);
  color: #0C2848;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

/* ── MAIN WRAPPER ────────────────────────────────────────────── */
.admin-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

/* ── STAT CARDS ──────────────────────────────────────────────── */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--admin-transition), transform var(--admin-transition);
}
.admin-stat-card:hover {
  border-color: var(--admin-border-hover);
  transform: translateY(-2px);
}

.admin-stat-new      { border-color: rgba(52,211,153,0.2);  background: linear-gradient(135deg, var(--admin-surface), rgba(52,211,153,0.04)); }
.admin-stat-read     { border-color: rgba(99,179,237,0.2);  background: linear-gradient(135deg, var(--admin-surface), rgba(99,179,237,0.04)); }
.admin-stat-archived { border-color: rgba(255,255,255,0.07); }

.admin-stat-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2px;
}
.admin-stat-icon--total    { background: rgba(197,168,128,0.12); color: var(--admin-accent); }
.admin-stat-icon--new      { background: rgba(52,211,153,0.12);  color: var(--admin-success); }
.admin-stat-icon--read     { background: rgba(99,179,237,0.12);  color: var(--admin-info); }
.admin-stat-icon--archived { background: rgba(255,255,255,0.05); color: var(--admin-text-muted); }

.admin-stat-number {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem; font-weight: 700;
  color: var(--admin-accent);
  line-height: 1;
}
.admin-stat-new      .admin-stat-number { color: var(--admin-success); }
.admin-stat-read     .admin-stat-number { color: var(--admin-info); }
.admin-stat-archived .admin-stat-number { color: var(--admin-text-muted); }

.admin-stat-label {
  font-size: 0.73rem;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── FILTERS ─────────────────────────────────────────────────── */
.admin-filters {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.admin-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 140px;
}
.admin-filter-search { flex: 1; min-width: 200px; }

.admin-filter-group label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--admin-text-muted);
}

.admin-filter-group select,
.admin-filter-group input[type="text"] {
  padding: 9px 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--admin-transition);
  /* Custom arrow for select on dark backgrounds */
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238FA0AE' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  padding-right: 32px;
}
.admin-filter-group input[type="text"] {
  background-image: none;
  padding-right: 14px;
}

.admin-filter-group select:focus,
.admin-filter-group input:focus {
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 2px rgba(197,168,128,0.1);
}

.admin-filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-bottom: 1px;
}

/* Results bar */
.admin-results-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--admin-text-muted);
  padding: 0 2px;
}
.admin-results-filter-tag {
  background: rgba(197,168,128,0.12);
  color: var(--admin-accent);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── TABLE ───────────────────────────────────────────────────── */
.admin-table-wrap {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  /* overflow:visible so status dropdowns are never clipped */
  overflow: visible;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead {
  background: rgba(0,0,0,0.22);
  border-radius: var(--admin-radius) var(--admin-radius) 0 0;
}

.admin-table th {
  padding: 13px 16px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--admin-text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 13px 16px;
  font-size: 0.85rem;
  border-top: 1px solid var(--admin-border);
  vertical-align: middle;
}

/* Row hover */
.admin-table tbody tr {
  transition: background var(--admin-transition);
}
.admin-table tbody tr:hover td {
  background: rgba(255,255,255,0.018);
}

/* New row highlight */
.admin-table tr.row-new td {
  background: rgba(197,168,128,0.03);
}
.admin-table tr.row-new:hover td {
  background: rgba(197,168,128,0.05);
}

.admin-table td a {
  color: var(--admin-accent);
  text-decoration: none;
}
.admin-table td a:hover { text-decoration: underline; }

.admin-empty {
  text-align: center;
  padding: 60px 16px !important;
  color: var(--admin-text-muted);
  font-size: 0.9rem;
}

/* Cells */
.admin-id {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  color: var(--admin-text-muted);
  font-weight: 600;
}

.admin-msg-cell {
  max-width: 260px;
  color: var(--admin-text-muted);
  line-height: 1.45;
  cursor: pointer;
}
.admin-msg-cell:hover { color: var(--admin-text); }
.admin-msg-preview {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  line-height: inherit;
}
.admin-msg-preview:hover {
  color: var(--admin-accent);
  text-decoration: underline;
}

.admin-date-cell { white-space: nowrap; font-size: 0.82rem; }
.admin-date-time { display: block; font-size: 0.7rem; color: var(--admin-text-muted); margin-top: 2px; }

/* Category badges */
.admin-badge-cat {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.admin-badge-holding     { background: rgba(197,168,128,0.15); color: var(--admin-accent); }
.admin-badge-hospitality { background: rgba(52,211,153,0.12);  color: var(--admin-success); }
.admin-badge-commercial  { background: rgba(99,179,237,0.12);  color: var(--admin-info); }
.admin-badge-finance     { background: rgba(159,122,234,0.12); color: #9f7aea; }

/* Status select */
.admin-status-select {
  padding: 6px 30px 6px 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--admin-border);
  border-radius: 7px;
  color: var(--admin-text);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--admin-transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%238FA0AE' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 8px) center;
}
.admin-status-select:focus { border-color: var(--admin-accent); }
.status-new      { border-color: rgba(52,211,153,0.45); }
.status-read     { border-color: rgba(99,179,237,0.45); }
.status-archived { border-color: rgba(255,255,255,0.15); }

/* File link */
.admin-file-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-no-file { color: var(--admin-text-muted); font-size: 0.8rem; }

/* ── TOAST NOTIFICATION ──────────────────────────────────────── */
.admin-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.admin-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  background: var(--admin-surface-2);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  font-size: 0.85rem;
  color: var(--admin-text);
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.16,1,0.3,1) forwards;
}
.admin-toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}
.admin-toast--success { border-color: rgba(52,211,153,0.35); }
.admin-toast--error   { border-color: rgba(232,64,87,0.35); }
.admin-toast-icon--success { color: var(--admin-success); }
.admin-toast-icon--error   { color: var(--admin-danger); }

@keyframes toastIn  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); }    to { opacity:0; transform:translateY(6px); } }

/* ── VIEW MESSAGE MODAL ──────────────────────────────────────── */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 8000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s;
}
.admin-modal-overlay.visible {
  display: flex;
  opacity: 1;
}

.admin-modal {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  transform: translateY(16px);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
.admin-modal-overlay.visible .admin-modal { transform: translateY(0); }

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
}
.admin-modal-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--admin-text);
}
.admin-modal-close {
  background: none;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color var(--admin-transition), background var(--admin-transition);
  flex-shrink: 0;
}
.admin-modal-close:hover { color: var(--admin-text); background: rgba(255,255,255,0.07); }

.admin-modal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--admin-border);
}
.admin-modal-meta-item label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--admin-text-muted);
  margin-bottom: 4px;
}
.admin-modal-meta-item span,
.admin-modal-meta-item a {
  font-size: 0.88rem;
  color: var(--admin-text);
}
.admin-modal-meta-item a { color: var(--admin-accent); text-decoration: none; }
.admin-modal-meta-item a:hover { text-decoration: underline; }

.admin-modal-message-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--admin-text-muted);
  margin-bottom: 10px;
}
.admin-modal-message-body {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--admin-text);
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 16px;
}

/* ── MOBILE RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1100px) {
  .admin-table th:nth-child(5),
  .admin-table td:nth-child(5) { max-width: 180px; }
}

@media (max-width: 900px) {
  .admin-header { padding: 0 16px; }
  .admin-header-inner { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 8px; }
  .admin-main { padding: 16px; }

  .admin-stats-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  .admin-filter-form { flex-direction: column; align-items: stretch; }
  .admin-filter-group,
  .admin-filter-search { min-width: auto; width: 100%; }
  .admin-filter-actions { justify-content: flex-start; }

  /* Hide desktop table header */
  .admin-table thead { display: none; }

  /* Stack rows as cards */
  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td { display: block; width: 100%; }

  .admin-table-wrap { overflow: hidden; border-radius: var(--admin-radius); }

  .admin-table tr {
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    background: var(--admin-surface);
  }
  .admin-table tr.row-new { border-color: rgba(197,168,128,0.3); }

  .admin-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 7px 0;
    border-top: none;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.82rem;
    gap: 12px;
  }
  .admin-table td:last-child { border-bottom: none; padding-top: 10px; }

  .admin-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--admin-text-muted);
    flex-shrink: 0;
    padding-top: 2px;
    min-width: 70px;
  }

  .admin-msg-cell { max-width: none; text-align: right; }
  .admin-file-link { max-width: 200px; }
  .admin-status-select { width: auto; }
}

@media (max-width: 540px) {
  .admin-stats-row { grid-template-columns: 1fr 1fr; }
  .admin-login-card { padding: 36px 24px 28px; }
  .admin-modal { padding: 24px; }
  .admin-modal-meta { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .admin-stats-row { grid-template-columns: 1fr; }
}
