/**
 * Online Transfer Certificate Application System
 * School-themed styles - Roboto Slab, soft academic colors
 */

@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;600;700&display=swap');

:root {
  --font-slab: 'Roboto Slab', serif;
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-600: #475569;
  --slate-700: #334155;
}

* {
  font-family: var(--font-slab);
}

/* Smooth scroll and base */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 30%, #f1f5f9 100%);
}

/* Card styling - school themed */
.tc-card {
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.08), 0 2px 4px -2px rgba(99, 102, 241, 0.06);
  transition: box-shadow 0.2s ease;
}

.tc-card:hover {
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.1), 0 4px 6px -4px rgba(99, 102, 241, 0.08);
}

/* Input focus ring - indigo */
input:focus, textarea:focus, select:focus {
  --tw-ring-color: rgba(99, 102, 241, 0.4);
}

/* Skeleton pulse - reusable */
.skeleton {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  border-radius: 0.5rem;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Toaster container - top right */
#toaster-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 24rem;
}

/* Print styles - hide non-print elements on TC template */
@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: white;
  }
}

/* Toaster toast entrance */
.toaster-toast {
  animation: toaster-in 0.3s ease-out;
}
@keyframes toaster-in {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Status badges */
.badge-pending { background-color: #fef3c7; color: #92400e; }
.badge-approved { background-color: #d1fae5; color: #065f46; }
.badge-issued { background-color: #dbeafe; color: #1e40af; }

/* Site header & footer - #032148 */
.tc-site-header,
.tc-site-footer {
  background-color: #032148;
  color: #fff;
}
.tc-header-inner,
.tc-footer-inner {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0.75rem 1rem;
}
@media (min-width: 640px) {
  .tc-header-inner,
  .tc-footer-inner {
    padding: 1rem 1.5rem;
  }
}
@media (min-width: 1024px) {
  .tc-header-inner,
  .tc-footer-inner {
    padding: 1rem 2rem;
  }
}
.tc-header-logo-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .tc-header-logo-wrap {
    gap: 1rem;
  }
}
.tc-header-logo {
  height: 3rem;
  width: auto;
  max-height: 56px;
  object-fit: contain;
}
@media (min-width: 640px) {
  .tc-header-logo {
    height: 3.5rem;
    max-height: 64px;
  }
}
.tc-header-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  width: 3rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.tc-header-logo-placeholder .material-icons {
  font-size: 2rem;
}
.tc-header-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  margin: 0;
}
@media (min-width: 640px) {
  .tc-header-title {
    font-size: 1.125rem;
    text-align: left;
  }
}
@media (min-width: 768px) {
  .tc-header-title {
    font-size: 1.25rem;
  }
}
.tc-footer-inner {
  text-align: center;
}
.tc-footer-copyright {
  font-size: 0.75rem;
  margin: 0;
  opacity: 0.9;
}
@media (min-width: 640px) {
  .tc-footer-copyright {
    font-size: 0.875rem;
  }
}

/* Form width - increased */
.tc-main-width {
  max-width: 56rem;
}
@media (min-width: 1024px) {
  .tc-main-width {
    max-width: 72rem;
  }
}

/* Mobile: ensure form and note don't overflow */
@media (max-width: 639px) {
  .tc-note-box {
    font-size: 0.8125rem;
  }
  .tc-header-title {
    max-width: 100%;
  }
}

/* jQuery validation error */
label.error {
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: block;
}
input.error,
textarea.error {
  border-color: #dc2626;
  --tw-ring-color: rgba(220, 38, 38, 0.4);
}

/* ========== Admin Dashboard ========== */
.admin-dashboard {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  min-height: 100vh;
}

.admin-header {
  background: linear-gradient(135deg, #032148 0%, #053267 50%, #032148 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(3, 33, 72, 0.25);
  position: relative;
  overflow: visible;
}
.admin-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.admin-header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 1;
}
.admin-header-left { display: flex; align-items: center; gap: 1rem; }
.admin-header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  color: rgba(255,255,255,0.9);
  transition: background 0.2s, color 0.2s;
}
.admin-header-back:hover { background: rgba(255,255,255,0.12); color: #fff; }
.admin-header-brand { display: flex; align-items: center; gap: 0.75rem; }
.admin-header-logo-wrap {
  position: relative;
  flex-shrink: 0;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-header-logo {
  height: 2.75rem;
  width: auto;
  max-width: 2.75rem;
  object-fit: contain;
}
.admin-header-logo-placeholder {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.9);
}
.admin-header-logo-placeholder .material-icons { font-size: 1.5rem; }
.admin-header-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-header-icon .material-icons { font-size: 1.5rem; }
.admin-header-title { font-size: 1.2rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.admin-header-subtitle { font-size: 0.8rem; margin: 0.25rem 0 0 0; opacity: 0.85; }
.admin-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.admin-header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  color: rgba(255,255,255,0.9);
  transition: background 0.2s;
}
.admin-header-icon-btn:hover { background: rgba(255,255,255,0.12); }
.admin-notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
#notification-wrap { position: relative; z-index: 100; }
.admin-notification-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  width: 18rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(3,33,72,0.08);
  border: 1px solid #e2e8f0;
  padding: 0;
  z-index: 100;
  display: block;
}
.admin-notification-dropdown.hidden { display: none !important; }
.admin-notification-header { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; }
.admin-notification-mark-all {
  width: 100%;
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4f46e5;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-notification-mark-all:hover { background: #f8fafc; }
.admin-logout-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-logout-btn:hover { background: rgba(255,255,255,0.2); }

.admin-main {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-stat-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}
.admin-stat-card:hover {
  box-shadow: 0 8px 24px rgba(3,33,72,0.08);
  transform: translateY(-1px);
}
.admin-stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-stat-icon .material-icons { font-size: 1.5rem; color: #fff; }
.admin-stat-total .admin-stat-icon { background: linear-gradient(135deg, #032148, #053267); }
.admin-stat-pending .admin-stat-icon { background: linear-gradient(135deg, #d97706, #b45309); }
.admin-stat-issued .admin-stat-icon { background: linear-gradient(135deg, #059669, #047857); }
.admin-stat-value { font-size: 1.5rem; font-weight: 700; color: #0f172a; margin: 0; line-height: 1.2; }
.admin-stat-label { font-size: 0.75rem; color: #64748b; margin: 0.25rem 0 0 0; text-transform: uppercase; letter-spacing: 0.05em; }

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.admin-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  color: #94a3b8;
}
.admin-search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-search-input:focus {
  outline: none;
  border-color: #032148;
  box-shadow: 0 0 0 3px rgba(3, 33, 72, 0.12);
}
.admin-filters-selects { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.admin-filter-label { display: flex; flex-direction: column; gap: 0.25rem; }
.admin-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.875rem;
  color: #334155;
  min-width: 120px;
  cursor: pointer;
}
.admin-select:focus { outline: none; border-color: #032148; }

.admin-table-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
}
.admin-table-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.admin-table-title { font-size: 1rem; font-weight: 600; color: #0f172a; margin: 0; }
.admin-table-subtitle { font-size: 0.8125rem; color: #64748b; margin: 0.25rem 0 0 0; }
.admin-table-wrap {
  overflow-x: auto;
  min-height: 320px;
  position: relative;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.admin-th-reason { max-width: 180px; }
.admin-th-actions { width: 120px; text-align: center; }
.admin-table tbody tr {
  transition: background 0.15s;
  border-bottom: 1px solid #f1f5f9;
}
.admin-table tbody tr:hover { background: #f8fafc; }
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #334155;
  vertical-align: middle;
}
.admin-th-sno { width: 3.5rem; text-align: center; }
.admin-actions-group {
  display: inline-flex;
  align-items: stretch;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.admin-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
  color: #64748b;
}
.admin-action-btn + .admin-action-btn { border-left: 1px solid #e2e8f0; }
.admin-action-view { color: #4f46e5; }
.admin-action-view:hover { background: #e0e7ff; color: #4338ca; }
.admin-action-tc { color: #d97706; }
.admin-action-tc:hover { background: #fef3c7; color: #b45309; }
.admin-action-issued { color: #059669; }
.admin-action-issued:hover { background: #d1fae5; color: #047857; }
.admin-actions-group .material-icons { font-size: 1.125rem; }
.admin-table-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #94a3b8;
}
.admin-table-empty .material-icons { font-size: 3.5rem; opacity: 0.5; display: block; margin-bottom: 0.75rem; }
.admin-row-unread { background: #fefce8; }
.admin-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ca8a04;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ========== View Page (Application Details) ========== */
.view-page { background: #f8fafc; }
.view-page-header {
  background: #032148;
  color: #fff;
  box-shadow: 0 2px 12px rgba(3, 33, 72, 0.2);
}
.view-page-header-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.view-page-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  transition: color 0.2s;
}
.view-page-back:hover { color: #fff; }
.view-page-title { font-size: 1.125rem; font-weight: 600; margin: 0; }
.view-page-main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
}
.view-doc {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.view-doc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid #e2e8f0;
  background: #f8fafc;
}
.view-doc-id { font-family: ui-monospace, monospace; font-weight: 600; font-size: 1rem; color: #0f172a; }
.view-doc-status {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.view-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}
.view-section:last-child { border-bottom: none; }
.view-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #e2e8f0;
}
.view-section-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.5rem;
}
@media (min-width: 640px) {
  .view-section-grid { grid-template-columns: repeat(3, 1fr); }
}
.view-field-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.view-field-value { font-size: 0.9375rem; color: #0f172a; margin: 0; }
.view-section-text { font-size: 0.9375rem; color: #334155; margin: 0; line-height: 1.5; }
.view-section-pre { white-space: pre-wrap; }
.view-page-missing {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
}
.view-page-missing-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 500;
  color: #032148;
}
.view-page-missing-link:hover { text-decoration: underline; }

/* Confirm modals (logout, generate TC, mark issued) */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.confirm-modal.hidden { display: none; }
.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
}
.confirm-modal-box {
  position: relative;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 28rem;
  width: 100%;
  padding: 1.5rem;
  text-align: center;
}
.confirm-modal-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.confirm-modal-icon .material-icons { font-size: 1.75rem; color: #fff; }
.confirm-modal-icon-amber { background: #d97706; }
.confirm-modal-icon-slate { background: #475569; }
.confirm-modal-icon-green { background: #059669; }
.confirm-modal-title { font-size: 1.125rem; font-weight: 600; color: #0f172a; margin: 0 0 0.5rem 0; }
.confirm-modal-message { font-size: 0.875rem; color: #64748b; margin: 0 0 1.25rem 0; line-height: 1.5; }
.confirm-modal-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.confirm-modal-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
}
.confirm-modal-cancel {
  background: #f1f5f9;
  color: #475569;
}
.confirm-modal-cancel:hover { background: #e2e8f0; }
.confirm-modal-confirm {
  background: #032148;
  color: #fff;
}
.confirm-modal-confirm:hover { background: #053267; }

.admin-notification-list {
  max-height: 14rem;
  overflow-y: auto;
  border-bottom: 1px solid #f1f5f9;
}
.admin-notification-list.hidden { display: none; }
.admin-notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: #334155;
  border-bottom: 1px solid #f8fafc;
}
.admin-notification-item:last-child { border-bottom: none; }
.admin-notification-item-icon {
  font-size: 1rem;
  color: #64748b;
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.admin-notification-item-text { margin: 0; line-height: 1.4; }
