/* ═══════════════════════════════════════════════════════════
   style.css — SSC Physics Lab — Enhanced Dark Theme
   Features: Physics bg animations, parallax, glow borders,
             hover effects, click ripples, smooth transitions
   ═══════════════════════════════════════════════════════════ */

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

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

:root {
  --bg:       #060910;
  --panel:    #0d1220;
  --border:   #1e2840;
  --tx:       #e2e8f0;
  --tx2:      #a8b4cc;
  --txm:      #5a6480;
  --acc:      #7050e0;
  --acc-rgb:  112,80,224;
  --acc2:     #3a78e0;
  --ok:       #48c060;
  --err:      #e05050;
  --glow:     rgba(112,80,224,0.45);
  --glow2:    rgba(58,120,224,0.35);
  --glow-ok:  rgba(72,192,96,0.4);
}

/* ─────────────────────────────────────────────
   PHYSICS BACKGROUND — animated particles
   ───────────────────────────────────────────── */

body {
  font-family: 'Hind Siliguri', sans-serif;
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* The physics canvas layer */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    /* Atom orbit rings */
    radial-gradient(ellipse 600px 300px at 15% 25%, rgba(112,80,224,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 400px 200px at 80% 60%, rgba(58,120,224,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 300px 150px at 50% 85%, rgba(72,192,96,0.04) 0%, transparent 70%),
    /* Deep space base */
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(112,80,224,0.08) 0%, transparent 55%);
}

/* Floating physics symbols layer */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    /* Sine wave top-left */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='60'%3E%3Cpath d='M0 30 Q25 10 50 30 Q75 50 100 30 Q125 10 150 30 Q175 50 200 30' fill='none' stroke='rgba(112,80,224,0.07)' stroke-width='1.5'/%3E%3C/svg%3E"),
    /* Circuit dots */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ccircle cx='40' cy='40' r='1.5' fill='rgba(58,120,224,0.12)'/%3E%3Cline x1='0' y1='40' x2='37' y2='40' stroke='rgba(58,120,224,0.06)' stroke-width='1'/%3E%3Cline x1='43' y1='40' x2='80' y2='40' stroke='rgba(58,120,224,0.06)' stroke-width='1'/%3E%3Cline x1='40' y1='0' x2='40' y2='37' stroke='rgba(58,120,224,0.06)' stroke-width='1'/%3E%3Cline x1='40' y1='43' x2='40' y2='80' stroke='rgba(58,120,224,0.06)' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 200px 60px, 80px 80px;
  background-position: 0 20%, 0 0;
  animation: bgDrift 60s linear infinite;
}

@keyframes bgDrift {
  0%   { background-position: 0 20%, 0 0; }
  100% { background-position: 200px 20%, 80px 80px; }
}

/* Floating atoms — pure CSS elements */
.physics-atoms {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.atom {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: atomFloat linear infinite;
}

.atom::before, .atom::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.3;
  animation: orbitSpin linear infinite;
}
.atom::after { animation-duration: 3s; animation-direction: reverse; inset: -14px; opacity: 0.15; }

@keyframes atomFloat {
  0%   { transform: translateY(110vh) rotate(0deg);  opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

@keyframes orbitSpin {
  from { transform: rotate(0deg) scaleX(2.5); }
  to   { transform: rotate(360deg) scaleX(2.5); }
}

/* Electron trail */
.electron {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 6px var(--acc), 0 0 12px var(--acc);
  opacity: 0;
  animation: electronTrail linear infinite;
}

@keyframes electronTrail {
  0%   { opacity: 0; transform: translate(0,0); }
  10%  { opacity: 1; }
  90%  { opacity: 0.7; }
  100% { opacity: 0; transform: translate(var(--ex), var(--ey)); }
}

/* Wave lines */
.wave-line {
  position: absolute;
  height: 1px;
  opacity: 0;
  animation: waveSweep linear infinite;
  background: linear-gradient(90deg, transparent, var(--acc), var(--acc2), transparent);
}

@keyframes waveSweep {
  0%   { opacity: 0; transform: scaleX(0) translateX(-50%); }
  20%  { opacity: 0.4; transform: scaleX(1) translateX(0); }
  80%  { opacity: 0.3; }
  100% { opacity: 0; transform: scaleX(0) translateX(50%); }
}

/* Everything real sits above the bg */
.topbar, .app-body, .modal-overlay, .toast,
.account-panel-overlay {
  position: relative;
  z-index: 1;
}


/* ─────────────────────────────────────────────
   TOPBAR
   ───────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: .85rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background: rgba(6,9,16,0.92);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 100;
  transition: box-shadow .3s;
}

.topbar:hover {
  box-shadow: 0 2px 30px rgba(112,80,224,0.12);
}

.topbar-logo   { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.topbar-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #7050e0, #3a78e0);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 0 16px rgba(112,80,224,0.5);
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(112,80,224,0.5); }
  50%       { box-shadow: 0 0 28px rgba(112,80,224,0.85), 0 0 50px rgba(112,80,224,0.3); }
}

.topbar-title  { font-size: .95rem; font-weight: 700; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title span { color: var(--txm); font-weight: 400; font-size: .8rem; }
.topbar-right  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 8px; justify-content: flex-end; }


/* ─────────────────────────────────────────────
   USER BADGE
   ───────────────────────────────────────────── */
.user-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  cursor: pointer;
  transition: border-color .25s, box-shadow .25s, transform .2s;
  position: relative;
  overflow: hidden;
}

.user-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(112,80,224,0), rgba(112,80,224,0.08));
  opacity: 0;
  transition: opacity .3s;
}

.user-badge:hover {
  border-color: rgba(var(--acc-rgb), 0.7);
  box-shadow: 0 0 18px rgba(var(--acc-rgb), 0.3), inset 0 0 12px rgba(var(--acc-rgb), 0.05);
  transform: translateY(-1px);
}

.user-badge:hover::before { opacity: 1; }

.user-badge:active { transform: translateY(0) scale(0.97); }

.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #7050e0, #3a78e0);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 8px rgba(112,80,224,0.5);
  transition: box-shadow .25s;
}
.user-badge:hover .user-avatar {
  box-shadow: 0 0 16px rgba(112,80,224,0.8);
}

.user-name     { font-size: 12px; color: var(--tx2); font-weight: 600; }
.admin-tag     { font-size: 9px; background: rgba(208,64,32,.2); color: #e07050; border: 1px solid rgba(208,64,32,.3); border-radius: 10px; padding: 1px 6px; font-weight: 700; letter-spacing: .05em; }


/* ─────────────────────────────────────────────
   BUTTONS — Logout & Nav
   ───────────────────────────────────────────── */
.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px; color: var(--txm);
  cursor: pointer;
  transition: all .2s;
  font-family: 'Hind Siliguri', sans-serif;
  position: relative; overflow: hidden;
}

.logout-btn:hover {
  border-color: rgba(224,80,80,0.7);
  color: var(--err);
  box-shadow: 0 0 14px rgba(224,80,80,0.25);
}

.logout-btn:active { transform: scale(0.95); }

.nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px; color: var(--tx2);
  cursor: pointer;
  transition: all .2s;
  font-family: 'Hind Siliguri', sans-serif;
  text-decoration: none;
  display: flex; align-items: center; gap: 5px;
  position: relative; overflow: hidden;
}

.nav-btn:hover {
  border-color: rgba(var(--acc-rgb), 0.7);
  color: var(--tx);
  box-shadow: 0 0 16px rgba(var(--acc-rgb), 0.3);
  transform: translateY(-1px);
}

.nav-btn:active { transform: translateY(0) scale(0.96); }


/* ─────────────────────────────────────────────
   RIPPLE EFFECT — applied on click globally
   ───────────────────────────────────────────── */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(112,80,224,0.35);
  transform: scale(0);
  animation: rippleAnim 0.55s linear;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}


/* ─────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; animation: overlayFadeIn .25s ease; }

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

.modal {
  background: var(--panel);
  border: 1px solid rgba(var(--acc-rgb), 0.25);
  border-radius: 16px;
  width: 100%; max-width: 460px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(var(--acc-rgb), 0.2), 0 20px 60px rgba(0,0,0,0.7);
  overflow: hidden;
  animation: modalSlideIn .3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}

/* Glowing top border accent */
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--acc), var(--acc2), transparent);
  opacity: 0.8;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3  { font-size: 15px; font-weight: 700; color: var(--tx); }
.modal-close {
  background: transparent; border: none; color: var(--txm);
  font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--err); background: rgba(224,80,80,0.1); }

.modal-body { padding: 1.2rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }

.modal-field { margin-bottom: 14px; }
.modal-field label {
  display: block; font-size: 11px; color: var(--txm);
  margin-bottom: 6px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 13px;
  color: var(--tx); font-size: 13px;
  font-family: 'Hind Siliguri', sans-serif;
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: rgba(var(--acc-rgb), 0.7);
  box-shadow: 0 0 0 3px rgba(var(--acc-rgb), 0.12), 0 0 16px rgba(var(--acc-rgb), 0.2);
}

.modal-field input:hover:not(:focus),
.modal-field select:hover:not(:focus),
.modal-field textarea:hover:not(:focus) {
  border-color: rgba(var(--acc-rgb), 0.35);
}

.modal-field select option { background: #161b27; }
.modal-field textarea  { resize: vertical; min-height: 70px; line-height: 1.5; }

.modal-hint    { font-size: 11px; color: var(--txm); margin-top: 5px; font-family: 'JetBrains Mono', monospace; }
.modal-hint code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px; color: #a8d890; }

.modal-footer  { display: flex; gap: 8px; padding: 0 1.2rem 1.2rem; flex-shrink: 0; }

.modal-save {
  flex: 1; padding: 10px; border: none; border-radius: 9px;
  background: linear-gradient(135deg, #7050e0, #4a38b0);
  color: #fff; font-size: 13px; font-weight: 700;
  font-family: 'Hind Siliguri', sans-serif;
  cursor: pointer;
  transition: opacity .2s, box-shadow .25s, transform .15s;
  position: relative; overflow: hidden;
}

.modal-save:hover {
  opacity: .92;
  box-shadow: 0 0 22px rgba(112,80,224,0.55);
  transform: translateY(-1px);
}

.modal-save:active { transform: scale(0.97) translateY(0); }

.modal-cancel {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 9px;
  background: transparent; color: var(--txm); font-size: 13px;
  font-family: 'Hind Siliguri', sans-serif; cursor: pointer;
  transition: all .2s;
}

.modal-cancel:hover { border-color: var(--tx2); color: var(--tx2); }
.modal-cancel:active { transform: scale(0.97); }

.modal-msg     { font-size: 12px; padding: 0 1.2rem .8rem; min-height: 20px; flex-shrink: 0; }
.modal-msg.err { color: var(--err); }
.modal-msg.ok  { color: var(--ok); }


/* ─────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(13,18,32,0.95);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px; color: var(--tx2);
  box-shadow: 0 4px 30px rgba(0,0,0,0.6);
  opacity: 0; transition: all .3s; pointer-events: none; z-index: 500;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.ok  { border-color: rgba(72,192,96,0.5); color: var(--ok); box-shadow: 0 0 20px rgba(72,192,96,0.2); }
.toast.err { border-color: rgba(224,80,80,0.5); color: var(--err); box-shadow: 0 0 20px rgba(224,80,80,0.2); }


/* ─────────────────────────────────────────────
   SECTION LABEL
   ───────────────────────────────────────────── */
.section-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--txm);
  margin-bottom: .9rem;
  font-family: 'JetBrains Mono', monospace;
  position: relative; padding-left: 12px;
}

.section-lbl::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 8px var(--acc);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 6px var(--acc); transform: translateY(-50%) scale(1); }
  50%       { box-shadow: 0 0 14px var(--acc), 0 0 28px rgba(var(--acc-rgb),0.4); transform: translateY(-50%) scale(1.4); }
}


/* ─────────────────────────────────────────────
   PROGRESS BAR
   ───────────────────────────────────────────── */
.progress-bar-wrap  { margin: 4px 0 8px; padding: 0 12px; }
.progress-bar-track {
  height: 4px; background: rgba(255,255,255,.06);
  border-radius: 4px; overflow: hidden;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7050e0, #48c060);
  border-radius: 4px;
  transition: width .5s ease;
  box-shadow: 0 0 10px rgba(72,192,96,0.5);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(200%); }
}

.progress-label { font-size: 10px; color: var(--txm); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }


/* ─────────────────────────────────────────────
   GLOW BORDER UTILITY — add class .glow-border
   ───────────────────────────────────────────── */
.glow-border {
  border-color: rgba(var(--acc-rgb), 0.5) !important;
  box-shadow: 0 0 0 1px rgba(var(--acc-rgb), 0.2),
              0 0 20px rgba(var(--acc-rgb), 0.25);
}

/* Pulsing glow for active/highlighted borders */
.glow-pulse {
  animation: borderGlowPulse 2.5s ease-in-out infinite;
}

@keyframes borderGlowPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(var(--acc-rgb), 0.25),
                0 0 0 1px rgba(var(--acc-rgb), 0.15);
  }
  50% {
    box-shadow: 0 0 22px rgba(var(--acc-rgb), 0.55),
                0 0 40px rgba(var(--acc-rgb), 0.2),
                0 0 0 1px rgba(var(--acc-rgb), 0.4);
  }
}


/* ─────────────────────────────────────────────
   PARALLAX HOST — wrapper div added by JS
   ───────────────────────────────────────────── */
.parallax-layer {
  position: fixed; inset: 0;
  z-index: 0; pointer-events: none;
  will-change: transform;
  transition: transform .12s ease-out;
}

.parallax-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.06;
  transition: transform .12s ease-out;
}

.parallax-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7050e0, transparent 70%);
  top: -100px; left: -100px;
}

.parallax-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #3a78e0, transparent 70%);
  bottom: -80px; right: -80px;
}

.parallax-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #48c060, transparent 70%);
  top: 40%; left: 60%;
  opacity: 0.04;
}


/* ─────────────────────────────────────────────
   SCROLL-TRIGGERED REVEAL
   ───────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s ease, transform .55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delay helpers */
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }
.reveal-d4 { transition-delay: .32s; }


/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar-title span { display: none; }
  .topbar-right { width: 100%; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
