/* ========= Admin Panel Styles ========= */
:root {
  --navy-900: #0a1f3d;
  --navy-800: #112c54;
  --navy-700: #1a3a6b;
  --navy-600: #244d8a;
  --orange-500: #f26522;
  --orange-400: #ff853d;
  --orange-600: #d9541a;
  --ink-900: #0f1722;
  --ink-800: #1a2433;
  --ink-700: #2d3a4d;
  --ink-600: #4a5a70;
  --ink-500: #6b7b91;
  --ink-300: #b8c2d0;
  --ink-200: #d8dde5;
  --ink-100: #eceef3;
  --ink-50: #f5f6f9;
  --bg-warm: #faf8f5;
  --border: #e2e6ec;
  --border-strong: #cfd6e0;
  --success: #2f855a;
  --success-bg: #f0fff4;
  --danger: #c53030;
  --danger-bg: #fff5f5;
  --warning: #d69e2e;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 34, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 34, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 34, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-800);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ========= Login ========= */
.admin-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top left, rgba(242, 101, 34, 0.08), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(26, 58, 107, 0.1), transparent 50%),
    var(--navy-900);
  padding: 24px;
}

.login-wrap {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--orange-500);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(242, 101, 34, 0.1);
  border-radius: var(--r-md);
}

.login-logo svg { width: 32px; height: 32px; }

.login-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--ink-500);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-700);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
  background: #fff;
  color: var(--ink-800);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.15);
}

.login-error {
  padding: 10px 14px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ========= Buttons ========= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
  border: 2px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--orange-500);
  color: #fff;
  border-color: var(--orange-500);
}

.btn-primary:hover {
  background: var(--orange-600);
  border-color: var(--orange-600);
}

.btn-secondary {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}

.btn-secondary:hover {
  background: var(--navy-700);
  border-color: var(--navy-700);
}

.btn-outline {
  background: transparent;
  color: var(--ink-700);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  border-color: var(--ink-700);
  background: var(--ink-50);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #9b2c2c;
  border-color: #9b2c2c;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-hint {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-500);
  line-height: 1.6;
}

.login-hint code {
  background: var(--ink-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.75rem;
}

/* ========= Admin Layout ========= */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.admin-sidebar-brand {
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  color: var(--orange-400);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-sidebar-brand .brand-icon svg { width: 100%; height: 100%; }

.admin-sidebar-brand .brand-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-sidebar-brand .brand-text small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 2px;
}

.admin-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.admin-nav-item.active {
  background: rgba(242, 101, 34, 0.15);
  color: var(--orange-400);
  font-weight: 600;
}

.admin-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.admin-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.admin-sidebar-footer .logout-btn {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
}

.admin-sidebar-footer .logout-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

/* ========= Admin Main ========= */
.admin-main {
  flex: 1;
  margin-left: 240px;
  min-width: 0;
}

.admin-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  height: 60px;
}

.admin-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-900);
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-600);
}

.admin-content {
  padding: 28px;
}

.admin-section {
  display: none;
}

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

/* ========= Cards / Panels ========= */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
}

.card-subtitle {
  font-size: 13px;
  color: var(--ink-500);
  margin-top: 2px;
}

/* ========= Form Grid ========= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-group label .required {
  color: var(--danger);
}

.form-help {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 4px;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ========= Toggle Switch ========= */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.toggle-row:last-child { border-bottom: none; }

.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-700);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--ink-300);
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--orange-500);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ========= Alert / Toast ========= */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #c6f6d5;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fed7d7;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: #ebf8ff;
  color: #2c5282;
  border: 1px solid #bee3f8;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 240px;
  animation: slideIn 0.2s ease;
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--navy-700); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-900);
}

.stat-card.accent .stat-value { color: var(--orange-500); }

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

.data-table thead th {
  text-align: left;
  padding: 12px 14px;
  background: var(--ink-50);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--ink-700);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-700);
  vertical-align: top;
}

.data-table tbody tr:hover {
  background: var(--ink-50);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-new { background: #fff5f5; color: var(--danger); }
.badge-read { background: #ebf8ff; color: #2c5282; }
.badge-done { background: var(--success-bg); color: var(--success); }

/* ========= Inquiry Detail Modal ========= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 31, 61, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: var(--r-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--ink-100);
  color: var(--ink-800);
}

.modal-body {
  padding: 24px;
}

.detail-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  flex-shrink: 0;
  width: 120px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 2px;
}

.detail-value {
  flex: 1;
  font-size: 14px;
  color: var(--ink-800);
  word-break: break-word;
  white-space: pre-wrap;
}

.detail-value a { color: var(--orange-500); text-decoration: underline; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
}

/* ========= Pagination ========= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-600);
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-700);
  background: #fff;
  transition: all 0.15s ease;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--orange-500);
  color: var(--orange-500);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========= Mobile ========= */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--ink-700);
  cursor: pointer;
  padding: 4px;
}

@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 20px 16px; }
  .card { padding: 18px 16px; }
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .data-table tbody td {
    padding: 4px 14px;
    border: none;
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  .data-table tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
  }
  .pagination {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    text-align: center;
  }
  .pagination-buttons { justify-content: center; }
}
