/* =====================================================================
 * PADH RAHI PUBLIC — "LIGHT 3D" THEME
 * ---------------------------------------------------------------------
 * An add-on layer loaded AFTER styles.css. It only restyles; it does not
 * change how anything works. To go back to the old look, remove the
 * <link href="theme-3d.css"> line from the page.
 *
 * Speed rules followed here (so cheap phones don't lag):
 *   - motion uses only transform + opacity (no animated shadows / blur)
 *   - one small blur, on the sticky header only
 *   - everything that moves switches off with "reduce motion"
 * ===================================================================== */

:root {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: rgba(124, 58, 237, 0.12);
  --accent: #06b6d4;
  --pink: #ec4899;
  --sun: #fbbf24;
  --ink: #1e1b4b;
  --bg: #f6f3ff;
  --surface-card: #ffffff;
  --border: rgba(76, 29, 149, 0.12);
  --radius: 20px;
  --font-display: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;

  /* 3D depth: a light top edge + a soft shadow underneath */
  --depth-1: inset 0 1px 0 rgba(255, 255, 255, 0.95),
             0 1px 2px rgba(30, 16, 80, 0.06),
             0 10px 24px -14px rgba(46, 16, 101, 0.28);
  --depth-2: inset 0 1px 0 rgba(255, 255, 255, 0.95),
             0 2px 4px rgba(30, 16, 80, 0.06),
             0 22px 40px -18px rgba(46, 16, 101, 0.38);
  --shadow: var(--depth-1);
  --shadow-lg: var(--depth-2);
  --spring: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Background: soft colour glows + faint dot grid (static = no lag) ---------- */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(124, 58, 237, 0.07) 1px, transparent 1.2px),
    radial-gradient(900px 520px at 0% -8%, rgba(124, 58, 237, 0.16), transparent 62%),
    radial-gradient(760px 480px at 105% 6%, rgba(236, 72, 153, 0.12), transparent 60%),
    radial-gradient(820px 620px at 50% 108%, rgba(6, 182, 212, 0.12), transparent 62%);
  background-size: 22px 22px, auto, auto, auto;
  color: var(--ink);
}

/* ---------- Headings: modern font + gradient text ---------- */
h1, h2, .hero h1, .hero h2 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}
.hero h1, .hero h2, .gradient-glow {
  background: linear-gradient(100deg, #7c3aed 0%, #c026d3 45%, #ec4899 75%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}
.brand-text { font-family: var(--font-display); font-weight: 700; }

/* ---------- Sticky header: frosted glass ---------- */
.site-header {
  background: rgba(255, 255, 255, 0.78) !important;
  border-bottom: 1px solid rgba(124, 58, 237, 0.12) !important;
  box-shadow: 0 6px 20px -16px rgba(46, 16, 101, 0.45);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    background: rgba(255, 255, 255, 0.66) !important;
    -webkit-backdrop-filter: saturate(170%) blur(12px);
    backdrop-filter: saturate(170%) blur(12px);
  }
}
.brand-logo {
  border-radius: 14px !important;
  box-shadow: 0 3px 0 rgba(76, 29, 149, 0.25), 0 8px 16px -8px rgba(124, 58, 237, 0.55);
  /* Bigger logo (was 38px on laptops, 28px on phones) */
  width: 44px !important;
  height: 44px !important;
}
@media (min-width: 1100px) {
  .brand-logo { width: 56px !important; height: 56px !important; border-radius: 16px !important; }
  .brand-text { font-size: 1.4rem !important; }
}
@media (max-width: 480px) {
  .brand-logo { width: 40px !important; height: 40px !important; border-radius: 12px !important; }
}

/* ---------- 3D cards ---------- */
.submit-card,
.subject-card,
.exam-item-card,
.query-card,
.notes-section,
.countdown-card-inner,
.calendar-container {
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--depth-1) !important;
}

/* The calendar now sits on a card, so give it some inner space */
.calendar-container {
  padding: 0.9rem 0.6rem !important;
}

/* Cards that respond to touch / mouse */
.submit-card,
.subject-card,
.exam-item-card,
.query-card {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px)) !important;
  transition: transform 0.35s var(--spring), box-shadow 0.35s ease !important;
  will-change: transform;
}
.submit-card:active,
.subject-card:active,
.exam-item-card:active {
  --lift: 2px;
  transition-duration: 0.08s !important;
}
.tilt-on {
  --lift: -4px;
  box-shadow: var(--depth-2) !important;
}

/* Light "shine" that follows the mouse on tilting cards (laptops only, set by theme-3d.js) */
.tilt-on::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, 0.55), transparent 45%);
  mix-blend-mode: soft-light;
}
.submit-card, .exam-item-card, .query-card { position: relative; }

/* Home page grade cards: big emoji floats a little */
a.submit-card > span:first-child {
  display: inline-block;
  filter: drop-shadow(0 10px 10px rgba(76, 29, 149, 0.25));
  animation: floaty 4.5s ease-in-out infinite;
}
a.submit-card:nth-of-type(2) > span:first-child { animation-delay: -2.2s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-7px) rotate(3deg); }
}

/* Cards gently rise in when the page opens */
.submit-card, .exam-item-card, .query-card, .notes-section {
  animation: rise3d 0.55s var(--spring) both;
}
.exam-item-card:nth-child(2) { animation-delay: 0.05s; }
.exam-item-card:nth-child(3) { animation-delay: 0.1s; }
.exam-item-card:nth-child(4) { animation-delay: 0.15s; }
/* Uses "translate" (not "transform") so it never fights with the tilt effect */
@keyframes rise3d {
  from { opacity: 0; translate: 0 18px; }
  to { opacity: 1; translate: 0 0; }
}

/* ---------- 3D "pressable" buttons ---------- */
.btn {
  border-radius: 14px !important;
  font-weight: 700 !important;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease !important;
  box-shadow: 0 3px 0 rgba(30, 16, 80, 0.16), 0 8px 16px -10px rgba(30, 16, 80, 0.35) !important;
}
.btn:active {
  transform: translateY(3px) !important;
  box-shadow: 0 0 0 rgba(30, 16, 80, 0.16), 0 3px 8px -6px rgba(30, 16, 80, 0.35) !important;
}
.btn-primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #c026d3 100%) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow: 0 4px 0 #5b21b6, 0 12px 22px -10px rgba(124, 58, 237, 0.65) !important;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active {
  transform: translateY(4px) !important;
  box-shadow: 0 0 0 #5b21b6, 0 4px 10px -6px rgba(124, 58, 237, 0.6) !important;
}

/* Homework "Submit" stays green (= done), with its own 3D edge */
#btn-upload-hw-confirm {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 4px 0 #047857, 0 12px 22px -10px rgba(16, 185, 129, 0.7) !important;
}
#btn-upload-hw-confirm:active {
  box-shadow: 0 0 0 #047857, 0 4px 10px -6px rgba(16, 185, 129, 0.6) !important;
}
#btn-upload-hw-confirm:disabled { filter: saturate(0.6); opacity: 0.85; }

/* Header round buttons (bell, help desk) */
#notif-bell-btn, #helpdesk-header-link, .nav-link {
  box-shadow: 0 2px 0 rgba(76, 29, 149, 0.14), 0 6px 14px -10px rgba(46, 16, 101, 0.5) !important;
  transition: transform 0.08s ease, box-shadow 0.08s ease !important;
}
#notif-bell-btn:active, #helpdesk-header-link:active, .nav-link:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 rgba(76, 29, 149, 0.14) !important;
}

/* ---------- Inputs ---------- */
input[type="text"], input[type="password"], input[type="search"], input[type="url"], input[type="date"],
select, textarea, .search-input {
  border-radius: 14px !important;
  border: 1.5px solid rgba(124, 58, 237, 0.18) !important;
  background: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(30, 16, 80, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
input:focus, select:focus, textarea:focus, .search-input:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.16), inset 0 2px 4px rgba(30, 16, 80, 0.04) !important;
}

/* ---------- Homework calendar: chunky 3D tiles ---------- */
.cal-weekday {
  background: linear-gradient(135deg, #7c3aed, #c026d3) !important;
  border-radius: 10px !important;
  box-shadow: 0 3px 0 #5b21b6 !important;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.cal-day {
  border-radius: 12px !important;
  box-shadow: 0 3px 0 rgba(30, 16, 80, 0.10), 0 8px 14px -10px rgba(30, 16, 80, 0.35) !important;
  transition: transform 0.08s ease, box-shadow 0.08s ease !important;
}
.cal-day:active {
  transform: translateY(3px) !important;
  box-shadow: 0 0 0 rgba(30, 16, 80, 0.10) !important;
}
.cal-day-has-hw {
  box-shadow: 0 4px 0 #047857, 0 10px 18px -10px rgba(16, 185, 129, 0.75) !important;
}
.cal-day-has-hw:active {
  box-shadow: 0 0 0 #047857 !important;
}
.cal-day-today {
  outline: 3px solid rgba(236, 72, 153, 0.85);
  outline-offset: 2px;
  animation: todayGlow 2.4s ease-in-out infinite;
}
@keyframes todayGlow {
  0%, 100% { outline-color: rgba(236, 72, 153, 0.85); }
  50% { outline-color: rgba(124, 58, 237, 0.85); }
}
.cal-status-pill, .cal-event-pill { border-radius: 6px !important; }
.cal-prev-btn, .cal-next-btn { border-radius: 10px !important; }

/* ---------- Popups: flip in with a little 3D ---------- */
.modal-content {
  border-radius: 24px !important;
  border: 1px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 0 30px 60px -20px rgba(30, 16, 80, 0.55), inset 0 1px 0 #ffffff !important;
  animation: pop3d 0.4s var(--spring) both;
}
@keyframes pop3d {
  from { opacity: 0; transform: perspective(900px) rotateX(14deg) translateY(26px) scale(0.96); }
  to { opacity: 1; transform: perspective(900px) rotateX(0) translateY(0) scale(1); }
}
#hw-uploaded-card, #hw-upload-form-box {
  border-radius: 16px !important;
  box-shadow: 0 3px 0 rgba(30, 16, 80, 0.08), 0 12px 22px -16px rgba(30, 16, 80, 0.4);
}

/* ---------- Small touches ---------- */
.score-pill, .grade-badge, .exam-date-pill, .days-left-red { border-radius: 999px !important; }
::selection { background: rgba(236, 72, 153, 0.22); }
html { scroll-behavior: smooth; }

/* ---------- "Reduce motion" on the phone → no animation at all ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .submit-card, .subject-card, .exam-item-card, .query-card { transform: none !important; }
}
