/* ── Admin CSS ─────────────────────────────────── */

/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
  --sidebar-bg:     #1a3a27;
  --sidebar-hover:  rgba(255,255,255,0.08);
  --sidebar-active: rgba(255,255,255,0.16);
  --sidebar-width:  230px;
  --accent:         #4caf73;
  --accent-dim:     #2e7d32;
  --surface:        #ffffff;
  --bg:             #f0f4f1;
  --text:           #1c2b22;
  --text-muted:     #6b7c72;
  --border:         #dde8e0;
  --shadow:         0 2px 12px rgba(30, 60, 40, 0.08);
  --radius:         12px;
  --font-main:      'DM Sans', Arial, sans-serif;
  --font-mono:      'DM Mono', monospace;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font-main);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}

.sidebar-icon {
  font-size: 20px;
  color: var(--accent);
}

.sidebar-title {
  color: white;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: none;
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  position: relative;
}

.sidebar-btn:hover {
  background: var(--sidebar-hover);
  color: white;
}

.sidebar-btn.active {
  background: var(--sidebar-active);
  color: white;
}

.btn-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-back {
  display: block;
  padding: 10px 14px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13px;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-back:hover {
  background: var(--sidebar-hover);
  color: white;
}

.sidebar-logout {
  display: block;
  padding: 10px 14px;
  margin-top: 6px;
  color: rgba(255, 100, 100, 0.8);
  text-decoration: none;
  font-size: 13px;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-logout:hover {
  background: rgba(255, 80, 80, 0.12);
  color: #ff6b6b;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  max-width: 960px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.admin-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.admin-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.admin-date {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.admin-tab {
  display: none;
}

.admin-tab.active {
  display: block;
}

/* ── Stat grid ───────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

/* ── Sections ────────────────────────────────────────────────────────────── */
.admin-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.section-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

/* ── Data table ──────────────────────────────────────────────────────────── */
.data-table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}

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

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f7faf8;
}

.visit-count {
  font-family: var(--font-mono);
  font-size: 13px;
  background: #eaf4ee;
  color: var(--accent-dim);
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
}

/* ── Messages ────────────────────────────────────────────────────────────── */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.msg-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: #fafcfb;
  transition: box-shadow 0.15s ease;
}

.msg-card:hover {
  box-shadow: var(--shadow);
}

.msg-card.msg-unread {
  border-left: 3px solid var(--accent);
  background: #f4fbf6;
}

.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.msg-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.msg-email {
  font-size: 12px;
  color: var(--text-muted);
}

.msg-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

.unread-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 32px 0;
}

/* ── Upload form ─────────────────────────────────────────────────────────── */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  text-align: center;
}

.upload-area:hover {
  border-color: var(--accent);
  background: #f4fbf6;
}

.upload-area input[type="file"] {
  display: none;
}

.upload-icon {
  font-size: 28px;
  color: var(--accent);
}

.upload-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.upload-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-btn {
  align-self: flex-start;
  padding: 11px 24px;
  background: var(--accent-dim);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease;
}

.upload-btn:hover {
  background: #1b5e20;
}

.back-dash {
   color: #000000;
  }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-wrapper {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    min-height: unset;
    position: static;
    padding: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .sidebar-header {
    padding: 0;
    border-bottom: none;
    margin-bottom: 0;
    flex: 1;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .sidebar-btn {
    width: auto;
    padding: 8px 14px;
  }

  .sidebar-footer {
    border-top: none;
    padding-top: 0;
  }

  .admin-main {
    padding: 20px 16px;
  }

  .admin-header {
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
  }

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

@media (max-width: 400px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}