/* ═══════════════════════════════════════════════════════════
   ADMIN DASHBOARD — STYLESHEET
   Digambar Jain Saitwal Vadhu-Var Parichay Mandal
   ═══════════════════════════════════════════════════════════ */

/* Full Width Container Layout */
body {
  background-color: #f8fafc;
  color: #0f172a;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

.page-shell {
  max-width: 1360px !important;
  margin: 0 auto;
  padding: 0 28px;
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 68px;
}

.header-inner .brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #991b1b;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-inner .brand::before {
  content: "🛡️";
  font-size: 1.3rem;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-links .text-link {
  color: #475569;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  background: #f1f5f9;
  transition: all 0.15s ease;
}

.header-links .text-link:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Heading Section */
.admin-heading {
  margin: 28px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 20px;
}

.admin-heading h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin: 4px 0 0;
  letter-spacing: -0.02em;
}

.admin-heading .eyebrow {
  color: #991b1b;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}

/* Admin Panel Wrapper */
.admin-panel {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  padding: 24px 28px 36px;
  margin-bottom: 48px;
}

/* Stats Cards Grid */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 1200px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  padding: 20px 18px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #94a3b8;
}

.stat-card:nth-child(1)::before { background: #3b82f6; } /* Total - Blue */
.stat-card:nth-child(2)::before { background: #f59e0b; } /* Pending - Amber */
.stat-card:nth-child(3)::before { background: #10b981; } /* Paid - Emerald */
.stat-card:nth-child(4)::before { background: #8b5cf6; } /* Manual - Purple */
.stat-card:nth-child(5)::before { background: #ef4444; } /* Failed - Red */
.stat-card:nth-child(6)::before { background: #06b6d4; } /* Revenue - Cyan */

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
  line-height: 1.3;
}

/* Tabs Navigation */
.dashboard-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 28px;
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 0.98rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s ease;
}

.tab-btn:hover:not(.active) {
  color: #0f172a;
  background: #f8fafc;
}

.tab-btn.active {
  color: #991b1b;
  border-bottom-color: #991b1b;
  background: #fef2f2;
}

/* Controls & Filter Bar */
.dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 16px;
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.search-bar {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 320px;
}

.search-bar input,
.search-bar select {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.92rem;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-bar input {
  flex: 1;
  min-width: 180px;
}

.search-bar input:focus,
.search-bar select:focus {
  border-color: #991b1b;
  box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.12);
}

.export-group {
  display: flex;
  gap: 10px;
}

/* Buttons */
.primary-button {
  background: #991b1b;
  color: #ffffff;
  border: none;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.primary-button:hover {
  background: #7f1d1d;
}

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

.secondary-button {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.secondary-button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
}

.applications-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
  white-space: nowrap;
}

.applications-table thead {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.applications-table th {
  padding: 14px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.applications-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.applications-table tbody tr:hover {
  background-color: #f8fafc;
}

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

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.font-bold {
  font-weight: 700;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 16px;
}

.pagination span {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
}

/* Detail View Layout */
.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.admin-panel-header h2 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  color: #0f172a;
}

.admin-panel-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

.detail-panel-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

@media (max-width: 900px) {
  .detail-panel-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.detail-column {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
}

.detail-column h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  color: #991b1b;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin: 0;
}

.metadata-grid dt {
  color: #64748b;
  font-weight: 600;
  font-size: 0.86rem;
}

.metadata-grid dd {
  margin: 0;
  color: #0f172a;
  font-weight: 500;
  font-size: 0.92rem;
  word-break: break-word;
}

/* Dialogs */
.admin-login-dialog,
.confirm-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: none;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  margin: auto;
}

.admin-login-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
}

.admin-login-card,
.confirm-card {
  padding: 32px;
}

.admin-login-card h2,
.confirm-card h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  color: #0f172a;
}

.admin-login-card p,
.confirm-card p {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.admin-login-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.admin-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-login-field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.admin-login-field input {
  padding: 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}

.admin-login-field input:focus {
  border-color: #991b1b;
  box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.12);
}

.admin-login-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}

.setup-toggle-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  margin-top: 14px;
  width: 100%;
  font-size: 0.86rem;
  text-decoration: underline;
}

.setup-toggle-btn:hover {
  color: #0f172a;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
