/* ============================================================
   Admin Portal Styles — Maharashtra Grand Innovation Challenge
   ============================================================ */

body.admin-body {
  background: #f0f4f9;
  color: #2c3e55;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  margin: 0;
  min-height: 100vh;
}

/* ── Navbar ── */
.admin-navbar {
  background: #0a1f3c;
  border-bottom: 2px solid #9c6b2e;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 200;
}

.admin-navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.admin-nav-brand h2 { font-size: 1.05rem; font-weight: 800; color: #fff; margin: 0; }

.admin-pill-badge {
  background: #9c6b2e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-nav-tools { display: flex; gap: 0.65rem; align-items: center; }

.btn-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-nav-link:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.4); }

/* ── Login Gate ── */
.login-page-wrapper {
  min-height: calc(100vh - 66px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #d3dae6;
  box-shadow: 0 8px 32px rgba(10,31,60,0.1);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-icon-ring {
  width: 56px;
  height: 56px;
  background: #f7f1e7;
  border: 2px solid #e3d2a3;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1.5rem;
}

.login-card h3 {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0a1f3c;
  margin-bottom: 0.4rem;
}

.login-card p {
  text-align: center;
  font-size: 0.85rem;
  color: #5a6a7e;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.login-error-msg {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 0.83rem;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  display: none;
}

.login-field { margin-bottom: 1.25rem; }

.login-field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: #1c2e45;
  margin-bottom: 0.4rem;
}

.login-field input {
  width: 100%;
  padding: 0.68rem 0.9rem;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1.5px solid #c4cdd9;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.login-field input:focus {
  border-color: #1d5fc8;
  box-shadow: 0 0 0 3px rgba(29,95,200,0.12);
}

.btn-login {
  width: 100%;
  padding: 0.75rem;
  background: #9c6b2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.18s;
  letter-spacing: -0.01em;
}

.btn-login:hover { background: #895f28; }

html.admin-restoring .login-page-wrapper { display: none !important; }
html.admin-restoring #adminDashboard { display: block !important; }
html.admin-restoring #btnAdminLogout { display: inline-flex !important; }

/* ── Admin Dashboard Content ── */
.admin-content {
  max-width: 1280px;
  margin: 2rem auto 5rem;
  padding: 0 1.5rem;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-tile {
  background: #fff;
  border: 1px solid #d3dae6;
  border-radius: 12px;
  padding: 1.1rem 1.35rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 4px rgba(10,31,60,0.06);
}

.stat-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.icon-navy  { background: #eef2fb; }
.icon-amber { background: #f7f1e7; }
.icon-green { background: #e8f8f2; }
.icon-slate { background: #f1f4f9; }

.stat-info h5 {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8b9aad;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.2rem;
}

.stat-number {
  font-size: 1.65rem;
  font-weight: 800;
  color: #0a1f3c;
  margin: 0;
  line-height: 1;
}

/* Toolbar Card */
.admin-toolbar {
  background: #fff;
  border: 1px solid #d3dae6;
  border-radius: 12px;
  padding: 1rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(10,31,60,0.05);
}

.export-group { display: flex; gap: 0.65rem; flex-wrap: wrap; }

.btn-csv {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #0a7a4d;
  color: #fff;
  border: none;
  padding: 0.6rem 1.15rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-csv:hover { background: #076039; }

.btn-docx {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #1d5fc8;
  color: #fff;
  border: none;
  padding: 0.6rem 1.15rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-docx:hover { background: #1648a0; }

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.search-input {
  padding: 0.58rem 0.9rem;
  border: 1.5px solid #c4cdd9;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  min-width: 240px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search-input:focus { border-color: #1d5fc8; box-shadow: 0 0 0 3px rgba(29,95,200,0.1); }

.filter-select {
  padding: 0.58rem 2rem 0.58rem 0.8rem;
  border: 1.5px solid #c4cdd9;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%235a6a7e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.18s;
}
.filter-select:focus { border-color: #1d5fc8; }

.btn-icon-sm {
  width: 36px;
  height: 36px;
  border: 1.5px solid #c4cdd9;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.18s;
}
.btn-icon-sm:hover { background: #f0f4f9; border-color: #9baabf; }

/* Data Table */
.table-card {
  background: #fff;
  border: 1px solid #d3dae6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(10,31,60,0.05);
}

.table-scroller { overflow-x: auto; width: 100%; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead {
  background: #f6f8fb;
  border-bottom: 2px solid #e8edf4;
}

.admin-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 800;
  color: #5a6a7e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f0f4f9;
  vertical-align: middle;
  color: #2c3e55;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #f8fafd; }

.ref-chip {
  display: inline-block;
  background: #eef2fb;
  color: #1d5fc8;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
}

.sector-chip {
  display: inline-block;
  background: #f7f1e7;
  color: #895f28;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #e3d2a3;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-cell { font-weight: 700; color: #0a1f3c; max-width: 180px; }
.title-cell { max-width: 260px; color: #2c3e55; font-weight: 500; }

.row-action-group { display: flex; gap: 0.4rem; }

.btn-row-view, .btn-row-docx {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid #d3dae6;
  background: #fff;
  color: #2c3e55;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-row-view:hover { background: #eef2fb; border-color: #1d5fc8; color: #1d5fc8; }
.btn-row-docx:hover { background: #e8f8f2; border-color: #0a7a4d; color: #0a7a4d; }

.table-empty-state {
  padding: 3.5rem 1rem;
  text-align: center;
  color: #8b9aad;
  font-size: 0.9rem;
}

.spinner-ring {
  width: 22px;
  height: 22px;
  border: 2.5px solid #d3dae6;
  border-top-color: #1d5fc8;
  border-radius: 50%;
  animation: spinRing 0.8s linear infinite;
  margin: 0 auto 0.75rem;
}
@keyframes spinRing { to { transform: rotate(360deg); } }

/* ── Detail Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,31,60,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-sheet {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(10,31,60,0.2);
  overflow: hidden;
}

.modal-topbar {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid #eef1f5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.modal-topbar-left h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0a1f3c;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f4f9;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #5a6a7e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.modal-close:hover { background: #e2e8f0; }

.modal-scroll-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.detail-block {
  background: #f6f8fb;
  border: 1px solid #d3dae6;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.detail-block h4 {
  font-size: 0.82rem;
  font-weight: 800;
  color: #0a1f3c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #d3dae6;
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.detail-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.5rem;
}

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

.dl { font-size: 0.73rem; font-weight: 800; color: #8b9aad; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem; }
.dv { font-size: 0.875rem; color: #2c3e55; white-space: pre-wrap; word-break: break-word; }

.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid #eef1f5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .export-group, .filter-group { width: 100%; }
  .search-input { min-width: unset; width: 100%; }
  .detail-2col { grid-template-columns: 1fr; }
  .detail-full { grid-column: 1; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .btn-csv, .btn-docx { flex: 1; justify-content: center; }
}
