/* ============================================================
   GCC IT Student Portal — Stylesheet
   Palette: slate background, white cards, teal accent
   ============================================================ */

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

:root {
  --bg:        #f4f3f8;          /* light purple-tinted background */
  --surface:   #ffffff;
  --accent:    #3c2864;          /* GCC deep purple */
  --accent-dk: #2a1b48;          /* darker purple */
  --accent2:   #3c78b4;          /* GCC steel blue */
  --gold:      #f0a028;          /* GCC gold */
  --gold-dk:   #d48a18;          /* darker gold */
  --text:      #1a1028;
  --muted:     #6b6480;
  --border:    #e2dff0;
  --danger:    #ef4444;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(60,40,100,.08), 0 4px 16px rgba(60,40,100,.08);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Page wrapper ---- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Header ---- */
.site-header {
  background: var(--accent);
  border-bottom: 3px solid var(--gold);
  padding: 0 2rem;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 68px;
}

.logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: transparent;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-mark.large {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  margin: 0 auto 1.2rem;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.site-subtitle {
  font-size: .78rem;
  color: rgba(255,255,255,.65);
  margin-top: 1px;
}

.btn-logout {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,.35);
  color: rgba(255,255,255,.85);
  padding: .4rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
  transition: background .15s, color .15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* ---- Main ---- */
.main {
  flex: 1;
  padding: 3rem 2rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.admin-main {
  max-width: 1100px;
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 1.2rem;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  line-height: 1.8;
}

.site-footer .footer-credit {
  color: var(--accent);
  font-weight: 600;
}

.site-footer .footer-powered {
  color: var(--gold-dk);
  font-weight: 700;
}

/* ---- Search section ---- */
.search-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
}

.search-heading {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: .4rem;
}

.search-desc {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.search-form {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.input-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: .7rem .9rem .7rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem; /* 16px — prevents iOS auto-zoom */
  outline: none;
  transition: border-color .15s;
  background: var(--bg);
}

.search-input:focus {
  border-color: var(--gold);
  background: var(--surface);
}

/* ---- Loading spinner ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(26, 16, 40, 0.25);
  border-top-color: #1a1028;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.btn-search {
  padding: .7rem 1.6rem;
  background: var(--gold);
  color: #1a1028;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 110px;
  justify-content: center;
}

.btn-search:hover:not(:disabled) {
  background: var(--gold-dk);
}

.btn-search:disabled,
.btn-search.loading {
  opacity: .75;
  cursor: not-allowed;
}

/* Dim the input while loading */
.search-input:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.btn-search.full {
  width: 100%;
  margin-top: .5rem;
  padding: .75rem;
  display: flex;
  justify-content: center;
}

/* ---- Error ---- */
.error-msg {
  margin-top: 1rem;
  padding: .7rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: 8px;
  font-size: .88rem;
}

.hidden {
  display: none !important;
}

/* ---- Result card ---- */
.result-section {
  margin-top: 1.5rem;
}

.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .35s ease, transform .35s ease;
}

.result-card.show {
  opacity: 1;
  transform: translateY(0);
}

.result-badge {
  background: var(--accent);
  color: var(--gold);
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .5rem 1rem;
}

.result-body {
  padding: 1.8rem 2rem;
}

.result-name {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1.2rem;
  color: var(--text);
}

.result-rows {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.result-row {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.result-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  min-width: 90px;
}

.result-value {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
  max-width: 400px;
  margin: 8vh auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  text-align: center;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: .3rem;
}

.login-sub {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
}

.login-form {
  text-align: left;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.field input,
.field select {
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem; /* 16px — prevents iOS auto-zoom */
  outline: none;
  background: var(--bg);
  transition: border-color .15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--gold);
  background: var(--surface);
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.stats-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--gold);
}

.stat-label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
}

.admin-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem 2rem;
  margin-bottom: 1.5rem;
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem 1rem;
  margin-bottom: 1rem;
}

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1rem;
}

.table-toolbar .admin-section-title {
  margin-bottom: 0;
  flex-shrink: 0;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-search-input {
  padding: .5rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem; /* 16px — prevents iOS auto-zoom */
  outline: none;
  background: var(--bg);
  min-width: 220px;
  transition: border-color .15s;
}

.admin-search-input:focus {
  border-color: var(--gold);
  background: var(--surface);
}

.btn-export {
  padding: .5rem 1.1rem;
  border: 1.5px solid var(--accent);
  background: none;
  color: var(--accent);
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.btn-export:hover {
  background: var(--accent);
  color: var(--gold);
}

.btn-export.accent {
  border-color: var(--accent2);
  color: var(--accent2);
}

.btn-export.accent:hover {
  background: var(--accent2);
  color: #fff;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.student-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.student-table th {
  text-align: left;
  padding: .65rem .85rem;
  background: var(--bg);
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}

.student-table td {
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

.student-table tbody tr:hover {
  background: var(--bg);
}

.btn-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 6px;
  transition: background .15s;
}

.btn-delete:hover {
  background: #fef2f2;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .site-header { padding: 0 1rem; }
  .main { padding: 1.5rem 1rem; }
  .search-section, .admin-card { padding: 1.5rem 1rem; }
  .result-body { padding: 1.2rem 1rem; }
  .result-name { font-size: 1.3rem; }
  .table-toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar-right { margin-left: 0; }
}
