/* ============================================================
   KRITI Portal — Custom CSS
   IIT Kharagpur | KRITI Initiative
   ============================================================ */

/* ── ANIMATIONS ─────────────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes marquee {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

@keyframes pulse-ring {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(44, 41, 111, 0.4); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 10px rgba(44, 41, 111, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(44, 41, 111, 0); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-up   { animation: fadeUp 0.7s ease forwards; }
.animate-fade-in   { animation: fadeIn 0.5s ease forwards; }
.animate-slide-in  { animation: slideIn 0.4s ease forwards; }
.animate-marquee   { animation: marquee 30s linear infinite; }

/* ── REVEAL ON SCROLL ────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── TYPOGRAPHY ──────────────────────────────────────────────── */

html, body {
  font-family: 'Inter', sans-serif !important;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #1f2937;
  letter-spacing: -0.01em;
}

.font-serif { font-family: 'Playfair Display', Georgia, serif; }
.font-sans  { font-family: 'Inter', sans-serif; }
.font-mono  { font-family: 'DM Mono', monospace; }

/* ── TICKER ──────────────────────────────────────────────────── */

.ticker-wrap { overflow: hidden; }
.ticker-content { display: inline-block; white-space: nowrap; }

/* ── NAVBAR SCROLL SHADOW ────────────────────────────────────── */

#navbar.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,0.08); }

/* ── FORM STYLES ─────────────────────────────────────────────── */

.form-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  background: #fff;
  color: #0d0d0d;
  transition: border-color 0.2s, box-shadow 0.2s;
  border-radius: 0;
  outline: none;
}
.form-input:focus {
  border-color: #2c296f;
  box-shadow: 0 0 0 3px rgba(44, 41, 111, 0.08);
}
.form-input.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}
.form-input.success {
  border-color: #16a34a;
}
.form-input::placeholder { color: #94a3b8; }

.form-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.375rem;
}
.form-label .req { color: #dc2626; margin-left: 2px; }

.form-error {
  font-size: 0.75rem;
  color: #dc2626;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #2c296f;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
  border-radius: 0;
}
.btn-primary:hover  { background: #1e1b4b; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  color: #2c296f;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 1.5px solid #2c296f;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  border-radius: 0;
}
.btn-secondary:hover { background: #2c296f; color: #fff; }

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 0;
}
.btn-danger:hover { background: #b91c1c; }

/* Loading spinner on button */
.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PROGRESS BAR (Application Form) ────────────────────────── */

.progress-steps {
  display: flex;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.progress-steps::-webkit-scrollbar { display: none; }

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  cursor: pointer;
  position: relative;
}
.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 14px);
  right: calc(-50% + 14px);
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}
.progress-step.completed:not(:last-child)::after { background: #2c296f; }

.step-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}
.progress-step.active   .step-circle { border-color: #2c296f; background: #2c296f; color: #fff; }
.progress-step.completed .step-circle { border-color: #2c296f; background: #2c296f; color: #fff; }
.progress-step.completed .step-circle::after {
  content: '✓';
  font-size: 12px;
}

.step-label {
  font-size: 9px;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  text-align: center;
  white-space: nowrap;
}
.progress-step.active    .step-label { color: #2c296f; font-weight: 600; }
.progress-step.completed .step-label { color: #2c296f; }

/* ── WORD COUNTER ────────────────────────────────────────────── */

.word-counter {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
  margin-top: 4px;
  transition: color 0.2s;
}
.word-counter.warning { color: #d97706; }
.word-counter.error   { color: #dc2626; font-weight: 600; }

/* ── UPLOAD BOX ──────────────────────────────────────────────── */

.upload-box {
  border: 2px dashed #e2e8f0;
  background: #fafafa;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.upload-box:hover,
.upload-box.dragover {
  border-color: #2c296f;
  background: rgba(44, 41, 111, 0.03);
}
.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-box.has-file {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.03);
}

/* ── AUTOSAVE INDICATOR ──────────────────────────────────────── */

#autosave-indicator {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.3s;
}
#autosave-indicator.saving { color: #d97706; }
#autosave-indicator.saved  { color: #16a34a; }
#autosave-indicator.error  { color: #dc2626; }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────── */

.toast {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9999;
  min-width: 280px;
  max-width: 400px;
  padding: 12px 16px;
  border-left: 4px solid;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideIn 0.3s ease;
  font-size: 14px;
}
.toast.success { border-color: #16a34a; }
.toast.error   { border-color: #dc2626; }
.toast.info    { border-color: #2c296f; }
.toast.warning { border-color: #d97706; }

/* ── ADMIN SIDEBAR ───────────────────────────────────────────── */

.admin-sidebar {
  width: 240px;
  min-height: 100vh;
  background: #1e1b4b;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
}
.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.admin-sidebar-link:hover,
.admin-sidebar-link.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: #c9a84c;
}
.admin-content { margin-left: 240px; min-height: 100vh; background: #f8f9fa; }

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-content { margin-left: 0; }
}

/* ── STATUS BADGES ───────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 0;
}
.badge-draft        { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-submitted    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-under_review { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
.badge-shortlisted  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-selected     { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.badge-waitlisted   { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-rejected     { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-interview    { background: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }

/* ── RECOMMENDATION STATUS ───────────────────────────────────── */

.rec-status-invited   { color: #d97706; }
.rec-status-opened    { color: #2563eb; }
.rec-status-submitted { color: #16a34a; }
.rec-status-expired   { color: #dc2626; }

/* ── CARD HOVER EFFECTS ──────────────────────────────────────── */

.card-hover {
  transition: transform 0.2s, box-shadow 0.2s;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

/* ── LINE CLAMP ──────────────────────────────────────────────── */

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── SCROLLBAR ───────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── PRINT ───────────────────────────────────────────────────── */

@media print {
  .no-print { display: none !important; }
  .admin-sidebar { display: none !important; }
  .admin-content { margin-left: 0 !important; }
}

/* ── RESPONSIVE UTILITIES ────────────────────────────────────── */

@media (max-width: 640px) {
  .form-input { font-size: 16px; } /* Prevent iOS zoom */
  .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
}

/* ── SECTION DIVIDER ─────────────────────────────────────────── */

.section-divider {
  width: 48px;
  height: 3px;
  background: linear-gradient(to right, #2c296f, #c9a84c);
  margin: 0 auto 1.5rem;
}

/* ── DOSSIER VIEW (Reviewer) ─────────────────────────────────── */

.dossier-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2c296f;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.dossier-section h3 {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 1rem;
}

/* ── RATING STARS ────────────────────────────────────────────── */

.rating-stars { display: flex; gap: 4px; }
.rating-star {
  width: 20px; height: 20px;
  cursor: pointer;
  color: #e2e8f0;
  transition: color 0.1s;
}
.rating-star.active,
.rating-star:hover,
.rating-star:hover ~ .rating-star { color: #c9a84c; }

/* ── SKELETON LOADER ─────────────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 2px;
}