:root {
  --radius: 0.75rem;

  --background: oklch(0.985 0.006 248);
  --foreground: oklch(0.18 0.035 255);

  --card: oklch(1 0 0);
  --card-foreground: oklch(0.18 0.04 260);

  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.18 0.04 260);

  --primary: oklch(0.47 0.18 255);
  --primary-foreground: oklch(0.99 0.005 260);

  --secondary: oklch(0.955 0.012 248);
  --secondary-foreground: oklch(0.25 0.04 260);

  --muted: oklch(0.955 0.008 248);
  --muted-foreground: oklch(0.48 0.025 255);

  --accent: oklch(0.67 0.15 176);
  --accent-foreground: oklch(0.18 0.04 260);

  --destructive: oklch(0.6 0.22 25);
  --destructive-foreground: oklch(0.99 0.005 260);

  --success: oklch(0.66 0.16 160);
  --success-foreground: oklch(0.99 0.005 260);

  --warning: oklch(0.76 0.16 75);
  --warning-foreground: oklch(0.2 0.04 60);

  --info: oklch(0.65 0.15 230);
  --info-foreground: oklch(0.99 0.005 260);

  --border: oklch(0.9 0.014 248);
  --input: oklch(0.94 0.012 248);
  --ring: oklch(0.56 0.16 255);

  /* Subject palette */
  --physics: oklch(0.55 0.2 265);     /* indigo */
  --chemistry: oklch(0.65 0.17 175);  /* teal */
  --math: oklch(0.72 0.17 70);        /* amber */
  --biology: oklch(0.62 0.2 15);      /* rose */

  --shadow-soft: 0 1px 2px oklch(0.2 0.04 260 / 0.05), 0 16px 40px oklch(0.2 0.04 260 / 0.08);
  --shadow-glow: 0 0 0 1px oklch(0.55 0.18 255 / 0.14), 0 18px 44px oklch(0.55 0.18 255 / 0.18);
  --shadow-button: 0 1px 1px oklch(0.2 0.04 260 / 0.08), 0 10px 22px oklch(0.47 0.18 255 / 0.18);
  --shadow-card-hover: 0 20px 48px oklch(0.2 0.04 260 / 0.1);

  --gradient-aurora: linear-gradient(135deg, oklch(0.52 0.18 255), oklch(0.62 0.15 205) 48%, oklch(0.68 0.14 165) 100%);
  --gradient-warm: linear-gradient(135deg, oklch(0.78 0.16 60), oklch(0.7 0.2 25));
}

[data-theme="dark"] {
  --background: oklch(0.13 0.025 265);
  --foreground: oklch(0.96 0.005 260);
  --card: oklch(0.17 0.03 265);
  --card-foreground: oklch(0.96 0.005 260);
  --popover: oklch(0.17 0.03 265);
  --popover-foreground: oklch(0.96 0.005 260);
  --primary: oklch(0.7 0.18 265);
  --primary-foreground: oklch(0.13 0.025 265);
  --secondary: oklch(0.22 0.035 265);
  --secondary-foreground: oklch(0.96 0.005 260);
  --muted: oklch(0.22 0.035 265);
  --muted-foreground: oklch(0.7 0.02 260);
  --accent: oklch(0.7 0.16 175);
  --accent-foreground: oklch(0.13 0.025 265);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.7 0.18 265);
}

/* Base resets & Fonts */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  line-height: 1.18;
  color: var(--foreground);
}

p {
  line-height: 1.7;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 2.5rem;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid oklch(0.56 0.16 255 / 0.28);
  outline-offset: 2px;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
  box-shadow: none !important;
}

/* Animations */
@keyframes float-blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -20px) scale(1.05); }
}
.animate-float {
  animation: float-blob 12s ease-in-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1.4); opacity: 0; }
}
.pulse-ring {
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up {
  animation: fade-up 0.5s ease-out both;
}

/* Grid background pattern */
.grid-bg {
  background-image:
    linear-gradient(to right, oklch(0.55 0.18 265 / 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(0.55 0.18 265 / 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Custom Scrollbar for premium feel */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Bob the Virtual Buddy */
#bob-character {
  width: 130px;
  height: 130px;
  background: var(--primary);
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  position: relative;
  margin: 0 auto;
  transition: all 0.5s ease;
  box-shadow: var(--shadow-glow);
}

.bob-idle {
  animation: bob-float 4s ease-in-out infinite;
}

@keyframes bob-float {
  0% { transform: translateY(0px); border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
  50% { transform: translateY(-15px); border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  100% { transform: translateY(0px); border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
}

.bob-eyes {
  position: absolute;
  top: 35%;
  left: 20%;
  width: 60%;
  display: flex;
  justify-content: space-between;
}

.bob-eyes::before, .bob-eyes::after {
  content: '';
  width: 14px;
  height: 14px;
  background: var(--background);
  border-radius: 50%;
  animation: bob-blink 4s infinite;
}

@keyframes bob-blink {
  0%, 96%, 98% { transform: scaleY(1); }
  97% { transform: scaleY(0.1); }
}

.bob-mouth {
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 12px;
  border: 3px solid var(--background);
  border-top: none;
  border-radius: 0 0 24px 24px;
  transition: all 0.3s ease;
}

.bob-focus {
  background: var(--warning) !important;
  animation: bob-focus-breathe 3s ease-in-out infinite !important;
}
.bob-focus .bob-mouth {
  height: 3px;
  width: 16px;
  border: 3px solid var(--background);
  border-radius: 3px;
}

@keyframes bob-focus-breathe {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.bob-break {
  background: var(--success) !important;
  animation: bob-float 4s ease-in-out infinite !important;
}

/* SWOT Card classes */
.swot-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.swot-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.swot-s { border-left: 5px solid oklch(0.66 0.16 160); }
.swot-w { border-left: 5px solid oklch(0.6 0.22 25); }

/* Custom emoji button states */
.emoji-btn {
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
}
.emoji-btn.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  transform: scale(1.1);
}

/* Glassmorphism custom classes */
.glass-panel {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

/* ForceLoop product UI system */
.font-serif {
  font-family: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif !important;
  font-style: normal !important;
  letter-spacing: 0 !important;
}

.text-balance {
  text-wrap: balance;
}

.bg-primary,
.hover\:bg-primary:hover {
  background-color: var(--primary) !important;
}

.bg-destructive {
  background-color: var(--destructive) !important;
}

.bg-success {
  background-color: var(--success) !important;
}

.bg-warning {
  background-color: var(--warning) !important;
}

.text-primary {
  color: var(--primary) !important;
}

.text-destructive {
  color: var(--destructive) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.btn,
button.btn,
input[type="button"],
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.625rem;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem !important;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.1;
  text-align: center;
  box-shadow: var(--shadow-button);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover,
button.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px oklch(0.47 0.18 255 / 0.22);
  filter: brightness(1.03);
}

.btn:active,
button.btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px oklch(0.2 0.04 260 / 0.12);
}

.btn-secondary {
  background: var(--secondary) !important;
  color: var(--secondary-foreground) !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

.btn-secondary:hover {
  background: color-mix(in oklch, var(--secondary), var(--foreground) 5%) !important;
  box-shadow: var(--shadow-soft) !important;
}

.btn-danger {
  background: var(--destructive) !important;
  color: var(--destructive-foreground) !important;
  box-shadow: 0 10px 22px oklch(0.6 0.22 25 / 0.2) !important;
}

.btn-outline,
.admin-tab-btn,
.modules-filter-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  font-weight: 700;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.btn-sm {
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.78rem;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  min-height: 2.625rem;
  border: 1px solid var(--border) !important;
  border-radius: 0.75rem !important;
  background: var(--card) !important;
  color: var(--foreground) !important;
  box-shadow: 0 1px 1px oklch(0.2 0.04 260 / 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px oklch(0.56 0.16 255 / 0.12) !important;
}

textarea {
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in oklch, var(--muted-foreground), white 18%);
}

input[type="file"] {
  min-height: 2.75rem;
  border-radius: 0.75rem !important;
  background: var(--card) !important;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead {
  background: var(--muted);
}

th {
  color: var(--muted-foreground);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

th,
td {
  padding: 0.75rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background-color 0.16s ease;
}

tbody tr:hover {
  background: color-mix(in oklch, var(--muted), transparent 42%);
}

#view-auth {
  position: relative;
  background:
    url("../assets/login-background.png") center / auto no-repeat,
    linear-gradient(135deg, oklch(0.97 0.025 230), oklch(0.91 0.055 220));
}

#view-auth > .relative {
  max-width: none !important;
  width: 100% !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  padding: clamp(1.5rem, 4vw, 4rem) clamp(1.5rem, 5vw, 5rem) !important;
}

#view-auth section:first-of-type {
  display: none !important;
}

#view-auth section:first-of-type::after {
  content: none;
}

#view-auth section:first-of-type > * {
  display: none !important;
}

#view-auth section:first-of-type h1,
#view-auth section:first-of-type h2,
#view-auth section:first-of-type h3,
#view-auth section:first-of-type .font-serif {
  color: #fff !important;
}

#view-auth section:first-of-type p,
#view-auth section:first-of-type .text-muted-foreground {
  color: oklch(1 0 0 / 68%) !important;
}

#view-auth section:first-of-type .text-primary {
  color: oklch(0.72 0.15 215) !important;
}

#view-auth h1 {
  max-width: 11ch;
  font-size: clamp(2.9rem, 5vw, 4.9rem) !important;
  font-weight: 800;
}

#view-auth h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem) !important;
  font-weight: 800;
}

#view-auth .max-w-md.rounded-2xl {
  max-width: 31rem !important;
  border-radius: 1.25rem !important;
  padding: clamp(1.25rem, 4vw, 2.25rem) !important;
  background: color-mix(in oklch, var(--card), transparent 6%) !important;
  box-shadow: 0 24px 70px oklch(0.2 0.04 260 / 0.14) !important;
}

#view-auth > .relative > section:last-child {
  justify-content: flex-end !important;
  width: min(34rem, 100%) !important;
  padding: 0 !important;
  background: transparent !important;
}

.login-tab {
  min-height: 5rem;
  border-radius: 0.9rem !important;
  background: var(--card) !important;
  color: var(--foreground);
  box-shadow: 0 1px 2px oklch(0.2 0.04 260 / 0.04);
}

.login-tab .text-xs {
  font-size: 0.82rem !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
}

.login-tab:hover {
  transform: translateY(-1px);
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-soft);
}

.login-tab.active,
.login-tab.border-primary {
  background: oklch(0.97 0.025 255) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px oklch(0.56 0.16 255 / 0.1);
}

.sidebar {
  width: 17rem !important;
  padding: 1.15rem !important;
  background: linear-gradient(180deg, oklch(0.18 0.045 255), oklch(0.14 0.035 260)) !important;
  border-right: 1px solid oklch(1 0 0 / 8%) !important;
}

.nav-links li {
  min-height: 2.75rem;
  border: 1px solid transparent;
  color: oklch(1 0 0 / 72%);
  font-weight: 650;
}

.nav-links li:hover {
  background: oklch(1 0 0 / 8%) !important;
  color: white;
  border-color: oklch(1 0 0 / 8%);
}

.nav-links li.font-semibold,
.nav-links li.bg-sidebar-accent {
  background: oklch(1 0 0 / 12%) !important;
  color: white !important;
  border-color: oklch(1 0 0 / 12%);
  box-shadow: inset 3px 0 0 var(--accent);
}

.main-content {
  width: calc(100% - 17rem);
  padding: clamp(1rem, 2vw, 1.75rem) !important;
  background:
    radial-gradient(circle at 14% 12%, oklch(0.56 0.16 255 / 0.055), transparent 24rem),
    radial-gradient(circle at 92% 34%, oklch(0.67 0.15 176 / 0.055), transparent 26rem),
    linear-gradient(180deg, color-mix(in oklch, var(--background), white 18%), var(--background));
}

.main-content > div {
  max-width: none !important;
  width: 100%;
  gap: 1.25rem;
}

header h1,
.view > div:first-child h2,
.view > div:first-child h1 {
  font-weight: 800 !important;
}

#greeting {
  font-size: clamp(1.35rem, 2.2vw, 2.1rem) !important;
}

.view {
  scrollbar-gutter: stable;
}

.view.space-y-6 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 1.25rem !important;
}

.glass-panel,
.swot-card,
#subject-container > *,
#ladder-levels > *,
#history-list > *,
#error-log-container > *,
#analysis-container > * {
  border-radius: 0.9rem !important;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-soft);
}

.glass-panel {
  position: relative;
  overflow: hidden;
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, oklch(1 0 0 / 0.2), transparent 42%),
    radial-gradient(circle at 100% 0%, oklch(0.56 0.16 255 / 0.035), transparent 13rem);
}

.glass-panel > * {
  position: relative;
  z-index: 1;
}

.glass-panel:hover,
#subject-container > *:hover {
  box-shadow: var(--shadow-card-hover);
}

#view-dashboard > .relative {
  border-radius: 1.1rem !important;
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--card), var(--primary) 4%), var(--card)) !important;
}

#view-dashboard h2 {
  max-width: 18ch;
  font-size: clamp(1.8rem, 3vw, 3rem) !important;
  font-weight: 800;
}

#view-modules > div:nth-of-type(3) {
  justify-content: flex-start !important;
  overflow-x: auto;
  border-bottom-color: var(--border);
}

#view-modules > div:first-child,
#view-errorlog > div:first-child,
#view-study > div:first-child,
#view-ladder > div:first-child,
#view-history > div:first-child,
#view-quiz > div:first-child,
#view-reattempt > div:first-child,
#view-mentor > div:first-child,
#view-admin > div:first-child,
#view-builder > div:first-child {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.35rem;
}

#view-modules > div:first-child {
  display: block !important;
  padding-bottom: 0.25rem;
}

#modules-subject-strip,
#subject-container {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
}

#modules-subject-strip > * {
  min-height: 6.6rem;
  padding: 1rem 1.1rem !important;
}

#modules-subject-strip .font-serif {
  font-size: 1rem !important;
  font-weight: 800 !important;
}

#subject-container > * {
  min-height: 17rem;
  padding: 1.1rem !important;
}

#subject-container h3 {
  color: var(--foreground);
  font-size: 1.12rem !important;
  font-weight: 800 !important;
}

#subject-container p,
#subject-container span {
  line-height: 1.45;
}

#subject-container .btn {
  margin-top: auto;
}

.modules-filter-btn {
  min-height: 2.35rem;
  padding: 0.5rem 0.9rem !important;
  border-radius: 0.7rem !important;
  white-space: nowrap;
}

.modules-filter-btn:hover {
  color: var(--foreground) !important;
  border-color: color-mix(in oklch, var(--primary), var(--border) 35%);
  transform: translateY(-1px);
}

.modules-filter-btn.active {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  box-shadow: var(--shadow-button);
}

#view-modules .flex.gap-2.bg-muted\/60,
#view-study .flex.gap-2.bg-muted\/60 {
  border-radius: 0.85rem !important;
  padding: 0.35rem !important;
  overflow-x: auto;
}

#quiz-question,
#reattempt-question {
  font-size: clamp(1.2rem, 2.2vw, 1.75rem) !important;
  font-weight: 800;
  line-height: 1.45 !important;
}

#quiz-options,
#reattempt-options {
  gap: 0.75rem;
}

.quiz-option,
.reattempt-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 1rem 1.1rem !important;
  border-radius: 0.9rem !important;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.55;
  box-shadow: 0 1px 2px oklch(0.2 0.04 260 / 0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.quiz-option::before,
.reattempt-option::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.45rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  flex: 0 0 auto;
}

.quiz-option:hover,
.reattempt-option:hover {
  transform: translateY(-1px);
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-soft);
}

.quiz-option.border-primary,
.reattempt-option.border-primary,
.quiz-option.bg-primary\/5,
.reattempt-option.bg-primary\/5 {
  background: oklch(0.97 0.025 255) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px oklch(0.56 0.16 255 / 0.11);
}

.quiz-option.border-primary::before,
.reattempt-option.border-primary::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 2px var(--card);
}

#quiz-progress-bar,
#reattempt-progress-bar {
  transition: width 0.28s ease;
}

#view-result > .max-w-4xl {
  max-width: 76rem !important;
  margin-inline: 0 !important;
}

#result-score {
  font-size: clamp(3rem, 7vw, 5rem) !important;
}

/* Removed legacy hardcoded Study Room grid columns and Focus Rhythm pseudo-element styling to support new dynamic layout */

#view-study #bob-character {
  width: 72px;
  height: 72px;
}

#bob-character {
  max-width: 18vw;
  max-height: 18vw;
}

#bob-dialogue {
  max-width: 18rem;
  font-size: clamp(0.98rem, 1.4vw, 1.15rem) !important;
  line-height: 1.35 !important;
}

#view-study #bob-character + .mt-6 {
  margin-top: 0.85rem !important;
}

#view-study svg[viewBox="0 0 260 260"] {
  width: clamp(136px, 12vw, 166px);
  height: clamp(136px, 12vw, 166px);
}

#pomo-time-display {
  font-size: clamp(2rem, 3vw, 2.55rem) !important;
}

#view-study .relative.mt-8 {
  margin-top: 0.8rem !important;
}

#view-study .mt-8.flex.gap-3 {
  margin-top: 0.8rem !important;
}

#view-study .flex.gap-2.bg-muted\/60 {
  padding: 0.25rem !important;
}

#view-study .flex.gap-2.bg-muted\/60 button {
  min-height: 2.2rem;
  padding: 0.4rem 0.85rem !important;
  font-size: 0.78rem !important;
}

#view-study .mt-8.flex.gap-3 .btn {
  min-height: 2.35rem;
  padding: 0.5rem 0.9rem !important;
}

#view-mentor .grid,
#view-admin .grid {
  align-items: start !important;
}

#view-mentor .min-h-\[300px\],
#view-admin .min-h-\[300px\],
#view-admin .min-h-\[250px\] {
  min-height: auto !important;
}

#view-mentor table,
#view-admin table {
  background: color-mix(in oklch, var(--card), var(--muted) 10%);
  border-radius: 0.75rem;
  overflow: hidden;
}

#view-mentor tbody:empty::after,
#view-admin tbody:empty::after {
  content: "No records yet";
  display: block;
  padding: 1.25rem;
  color: var(--muted-foreground);
}

.admin-tab-btn {
  min-height: 2.6rem;
  border-radius: 0.7rem 0.7rem 0 0;
  border-bottom-width: 2px !important;
}

.admin-tab-btn.active {
  background: var(--card);
  color: var(--primary) !important;
}

.emoji-btn {
  min-width: 2.5rem;
  min-height: 2.5rem;
}

/* Custom fade-in for page transition */
.fade-in-view {
  animation: fade-up 0.4s ease-out forwards;
}

/* Single-page view visibility rules */
.view {
  display: none !important;
  flex: 1;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.view.active {
  display: flex !important;
}

/* Responsive Sidebar slide-over drawer transitions */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.active-sidebar {
    transform: translateX(0) !important;
  }

  body {
    font-size: 14px;
  }

  .main-content {
    width: 100%;
    padding: 0.9rem !important;
  }

  .main-content > div {
    gap: 1rem;
  }

  header {
    position: sticky;
    top: 0;
    z-index: 70;
    margin: -0.9rem -0.9rem 0;
    padding: 0.85rem 0.9rem 0.75rem !important;
    background: color-mix(in oklch, var(--background), transparent 7%);
    backdrop-filter: blur(14px);
  }

  header .streak-badge {
    width: 100%;
    justify-content: center;
    min-height: 2.25rem;
  }

  #view-auth {
    overflow-y: auto;
    align-items: flex-start !important;
  }

  #view-auth > .relative {
    min-height: 100dvh !important;
    max-width: 100% !important;
    width: 100% !important;
    grid-template-columns: 1fr !important;
    padding: 1rem !important;
    overflow-x: hidden;
  }

  #view-auth .max-w-md.rounded-2xl {
    max-width: calc(100vw - 2rem) !important;
    width: calc(100vw - 2rem) !important;
    padding: 1.25rem !important;
    overflow: hidden;
  }

  #view-auth > .relative > section:last-child {
    max-width: calc(100vw - 2rem) !important;
    width: 100% !important;
    overflow: hidden;
  }

  #view-auth .grid.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .login-tab {
    min-height: 4.4rem;
    min-width: 0;
    padding: 0.7rem !important;
  }

  .login-tab .text-xs {
    font-size: 0.75rem !important;
  }

  #view-auth input,
  #view-auth button[type="submit"] {
    max-width: 100% !important;
  }

  #view-modules > div:first-child,
  #view-errorlog > div:first-child,
  #view-study > div:first-child,
  #view-ladder > div:first-child,
  #view-history > div:first-child,
  #view-quiz > div:first-child,
  #view-reattempt > div:first-child,
  #view-mentor > div:first-child,
  #view-admin > div:first-child,
  #view-builder > div:first-child {
    flex-direction: column;
    align-items: stretch;
  }

  #view-dashboard > .relative,
  .glass-panel {
    padding: 1rem !important;
  }

  #view-dashboard > .relative .grid,
  #view-study > .grid,
  #view-mentor .grid,
  #view-admin .grid {
    grid-template-columns: 1fr !important;
  }

  #swot-grid {
    grid-template-columns: 1fr !important;
    max-height: none !important;
  }

  .btn,
  button.btn {
    width: auto;
    min-height: 2.75rem;
    white-space: normal;
  }

  .flex.flex-wrap.gap-2 > .btn,
  #history-start-btn,
  #quiz-next-btn,
  #reattempt-submit-btn,
  #reattempt-next-btn {
    width: 100%;
  }

  .quiz-option,
  .reattempt-option {
    font-size: 0.95rem;
    padding: 0.9rem !important;
  }

  table {
    min-width: 620px;
  }

  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 768px) {
  .md\:ml-\[260px\] {
    margin-left: 17rem !important;
  }
}

@media (min-width: 1280px) {
  .main-content {
    padding-inline: 2rem !important;
  }

  #view-dashboard > .relative {
    min-height: 18rem;
  }
}

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

/* Mini Bob Bouncing Animation */
.mini-bob-bounce {
  animation: mini-bob-float 3s ease-in-out infinite;
}

@keyframes mini-bob-float {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-5px) scale(1.04); }
}

/* Print Media Overrides for Professional Reports */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .print\:hidden {
    display: none !important;
  }
  .glass-panel {
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
  header {
    border-bottom: 2px solid #000000 !important;
  }
}
