/* ==========================================================================
   GORIT - Material You Expressive (M3) Design System
   ========================================================================== */

:root {
  /* --- M3 Expressive Color System (Designated Primary: #3b82f7) --- */
  --primary: #3b82f7;
  --primary-hover: #2563eb;
  --primary-active: #1d4ed8;
  --primary-container: #eff6ff;
  --primary-container-hover: #dbeafe;
  --on-primary: #ffffff;
  --on-primary-container: #1d4ed8;

  /* --- Surface Roles (Expressive Tonal Layering) --- */
  --bg-primary: #f8f9fc;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f1f4f9;
  --bg-surface-hover: #e8edf5;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f4f6fa;
  --surface-container: #eef2f8;
  --surface-container-high: #e3e8f2;
  --surface-container-highest: #d9e1ec;

  /* --- Typography & Text Roles --- */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;

  /* --- Outlines & Dividers --- */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --outline-variant: #e2e8f0;

  /* --- Semantic Accents --- */
  --success: #10b981;
  --success-container: #ecfdf5;
  --on-success-container: #047857;

  --warning: #f59e0b;
  --warning-container: #fffbeb;
  --on-warning-container: #b45309;

  --danger: #ef4444;
  --danger-container: #fef2f2;
  --on-danger-container: #b91c1c;

  /* --- M3 Expressive Corner Radiuses --- */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* --- M3 Expressive Tonal Elevations --- */
  --card-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --card-shadow-hover: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --elevation-modal: 0 20px 30px -6px rgba(15, 23, 42, 0.18), 0 8px 12px -4px rgba(15, 23, 42, 0.08);

  /* --- M3 Motion Curves & Transitions --- */
  --m3-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --m3-easing-emphasized: cubic-bezier(0.05, 0.7, 0.1, 1);
  --m3-easing-decelerate: cubic-bezier(0, 0, 0.2, 1);
  --m3-duration-short: 150ms;
  --m3-duration-medium: 250ms;
  --m3-duration-long: 350ms;
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color var(--m3-duration-medium) var(--m3-easing-standard), color var(--m3-duration-medium) var(--m3-easing-standard);
}

/* Material Symbols Rounded Icon System (Official Google Fonts) */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
  flex-shrink: 0;
}

.material-symbols-rounded.icon-sm {
  font-size: 16px;
}

.material-symbols-rounded.icon-lg {
  font-size: 24px;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* App Container */
.app-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

/* Header */
.app-header {
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--m3-duration-medium) var(--m3-easing-standard);
}

/* Brand Identity Bar (Gorit Header) */
.brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  user-select: none;
}

.brand-logo-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  flex-shrink: 0;
  transition: transform var(--m3-duration-short) var(--m3-easing-standard);
}

.brand-logo-wrap:hover {
  transform: scale(1.06);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-name .brand-accent {
  color: var(--primary);
}

.brand-tagline {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-right-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@keyframes pulse-dot {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 1; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.lang-toggle-btn {
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.65rem;
  min-width: 62px;
}

/* Quick Semester Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.stat-box {
  background: var(--surface-container-low);
  border: 1px solid var(--border-color);
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: all var(--m3-duration-short) var(--m3-easing-standard);
}

.stat-box:hover {
  background: var(--surface-container);
  border-color: #cbd5e1;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.stat-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Navigation Tabs: M3 Expressive Segmented Pill Bar */
.nav-tab-container {
  display: flex;
  gap: 0.4rem;
  background: var(--surface-container-low);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-full);
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--m3-duration-short) var(--m3-easing-standard);
  user-select: none;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(59, 130, 247, 0.08);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 247, 0.35);
}

.tab-btn.active .material-symbols-rounded {
  color: #ffffff;
}

/* View Sections */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
  animation: m3FadeIn var(--m3-duration-medium) var(--m3-easing-standard);
}

/* Filter / Control Bar */
.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  box-shadow: var(--card-shadow);
  transition: border-color var(--m3-duration-short), box-shadow var(--m3-duration-short);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 247, 0.18);
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  pointer-events: none;
  font-size: 20px;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Chrono Banner */
.chrono-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-container);
  border: 1px solid rgba(59, 130, 247, 0.22);
  border-radius: var(--radius-lg);
  padding: 0.7rem 1.15rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--on-primary-container);
  font-weight: 500;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chrono-banner-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chrono-icon {
  color: var(--primary);
  font-size: 20px;
}

/* Collapsible Subject Card (M3 Expressive Elevation & Shape) */
.subject-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow var(--m3-duration-medium) var(--m3-easing-standard), 
              border-color var(--m3-duration-short) var(--m3-easing-standard),
              transform var(--m3-duration-short) var(--m3-easing-standard);
}

.subject-card:hover {
  border-color: color-mix(in srgb, var(--subject-color, var(--primary)) 45%, var(--border-color));
  box-shadow: var(--card-shadow-hover);
}

.subject-header {
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
  border-left: 6px solid var(--subject-color, var(--primary));
  background: var(--bg-surface);
  transition: background var(--m3-duration-short) var(--m3-easing-standard);
}

.subject-header:hover {
  background: var(--surface-container-low);
}

/* Subject Icon Box (Material Symbol Container) */
.subject-icon-box {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--subject-color, var(--primary)) 12%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--subject-color, var(--primary)) 28%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--subject-color, var(--primary));
  flex-shrink: 0;
  transition: transform var(--m3-duration-short) var(--m3-easing-standard);
}

.subject-icon-box .material-symbols-rounded {
  font-size: 24px;
}

.subject-info {
  flex: 1;
  min-width: 0;
}

.subject-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.subject-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.first-in-line-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.first-in-line-badge .material-symbols-rounded {
  font-size: 15px;
  color: #f59e0b;
}

/* Pinned Subject (General Tasks) */
.pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--on-primary-container);
  background: var(--primary-container);
  border: 1px solid rgba(59, 130, 247, 0.35);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.pinned-badge .material-symbols-rounded {
  font-size: 14px;
  color: var(--primary);
}

.subject-card.is-pinned {
  border-color: rgba(59, 130, 247, 0.35);
  box-shadow: 0 4px 18px rgba(59, 130, 247, 0.08);
}

/* Subject Emoji Icon */
.subject-emoji-icon {
  font-size: 1.55rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.icon-opt-btn .subject-emoji-icon {
  font-size: 1.4rem;
}

.subject-meta-chips {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Exam Badge Pills */
.exam-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-container);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: all var(--m3-duration-short);
}

.exam-badge .material-symbols-rounded {
  font-size: 15px;
}

.exam-badge.exam-urgent {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.4);
}
.exam-badge.exam-urgent .material-symbols-rounded {
  color: #dc2626;
}

.exam-badge.exam-soon {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.exam-badge.exam-soon .material-symbols-rounded {
  color: #d97706;
}

.exam-badge.exam-future {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.exam-badge.exam-future .material-symbols-rounded {
  color: #3b82f7;
}

.exam-badge.exam-past {
  background: var(--surface-container-low);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.exam-badge.exam-completed {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.exam-badge.exam-completed .material-symbols-rounded {
  color: #10b981;
}

/* Progress bar in header */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.45rem;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--subject-color, var(--primary));
  transition: width 0.4s var(--m3-easing-standard);
}

.progress-meta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.subject-chevron {
  color: var(--text-muted);
  transition: transform var(--m3-duration-medium) var(--m3-easing-standard);
  margin-left: 0.5rem;
}

.subject-card.is-expanded .subject-chevron {
  transform: rotate(180deg);
}

/* Subject Contents Section (M3 Expressive Animated Drawer) */
.subject-contents-drawer-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 340ms cubic-bezier(0.2, 0, 0, 1);
}

.subject-card.is-expanded > .subject-contents-drawer-wrapper {
  grid-template-rows: 1fr;
}

.subject-contents-drawer {
  overflow: hidden;
  min-height: 0;
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--surface-container-low) 50%, var(--bg-surface));
  border-top: 1px solid transparent;
  transition: padding 340ms cubic-bezier(0.2, 0, 0, 1), opacity 260ms cubic-bezier(0.2, 0, 0, 1), border-color 340ms cubic-bezier(0.2, 0, 0, 1);
  opacity: 0;
}

.subject-card.is-expanded > .subject-contents-drawer-wrapper > .subject-contents-drawer {
  padding: 1.25rem;
  border-top-color: var(--border-color);
  opacity: 1;
}

.contents-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.contents-count-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.contents-count-text .material-symbols-rounded {
  color: var(--primary);
  font-size: 18px;
}

/* Collapsible Content Item */
.content-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color var(--m3-duration-short), background-color var(--m3-duration-short);
  overflow: hidden;
}

.content-item-card:hover {
  border-color: color-mix(in srgb, var(--subject-color, var(--primary)) 40%, var(--border-color));
}

.content-item-card.is-completed {
  border-color: rgba(16, 185, 129, 0.35);
  background: color-mix(in srgb, var(--success) 3%, var(--bg-surface));
}

.content-item-card.is-completed .progress-fill {
  background: var(--success) !important;
}

.content-item-header {
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--m3-duration-short) ease;
}

.content-item-header:hover {
  background: var(--surface-container-low);
}

.content-header-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.content-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 2px;
}

.content-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--success);
  border-radius: 6px;
  transition: transform var(--m3-duration-short) ease;
}

.content-checkbox:hover {
  transform: scale(1.15);
}

.content-item-info {
  flex: 1;
  min-width: 0;
}

.content-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.content-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.content-status-icon {
  font-size: 18px;
  color: var(--text-muted);
}

.content-status-icon.done {
  color: var(--success);
}

.content-title-text {
  word-break: break-word;
}

.content-title-text.completed {
  color: var(--text-secondary);
}

.content-completed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.content-completed-badge .material-symbols-rounded {
  font-size: 13px;
  color: #10b981;
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.content-chevron {
  color: var(--text-muted);
  transition: transform var(--m3-duration-medium) var(--m3-easing-standard);
}

.content-item-card.is-expanded .content-chevron {
  transform: rotate(180deg);
}

/* Tasks Box (M3 Expressive Animated Drawer) */
.content-tasks-drawer-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 300ms cubic-bezier(0.2, 0, 0, 1);
}

.content-item-card.is-expanded > .content-tasks-drawer-wrapper {
  grid-template-rows: 1fr;
}

.content-tasks-drawer {
  overflow: hidden;
  min-height: 0;
  padding: 0 1.15rem;
  background: var(--surface-container-low);
  border-top: 1px dashed transparent;
  transition: padding 300ms cubic-bezier(0.2, 0, 0, 1), opacity 240ms cubic-bezier(0.2, 0, 0, 1), border-color 300ms cubic-bezier(0.2, 0, 0, 1);
  opacity: 0;
}

.content-item-card.is-expanded > .content-tasks-drawer-wrapper > .content-tasks-drawer {
  padding: 1rem 1.15rem;
  border-top-color: var(--border-color);
  opacity: 1;
}

.content-drawer-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

.content-drawer-status-summary {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.content-drawer-status-summary .material-symbols-rounded {
  font-size: 17px;
  color: var(--primary);
}

.btn-success-soft {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.btn-success-soft:hover {
  background: #d1fae5;
  color: #065f46;
}

.content-item-card.is-expanded .content-tasks-drawer {
  display: block;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.todo-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--m3-duration-short) ease;
}

.todo-row:hover {
  border-color: color-mix(in srgb, var(--subject-color, var(--primary)) 60%, var(--border-color));
}

.todo-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--subject-color, var(--primary));
  border-radius: 4px;
}

.todo-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary);
  word-break: break-word;
  transition: color 0.15s, background-color 0.15s;
}

.todo-text[contenteditable="true"] {
  padding: 2px 4px;
  border-radius: 4px;
}

.todo-text[contenteditable="true"]:hover {
  background-color: var(--surface-container);
  cursor: text;
}

.todo-text[contenteditable="true"]:focus {
  outline: 2px solid var(--primary);
  background-color: var(--bg-surface);
}

.todo-row.completed {
  background: color-mix(in srgb, var(--bg-surface) 60%, transparent);
}

.todo-row.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  opacity: 0.3;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.todo-row:hover .todo-delete-btn {
  opacity: 1;
  color: var(--danger);
}

.todo-delete-btn .material-symbols-rounded {
  font-size: 16px;
}

/* Priority & Reminder Badges on To-Dos */
.todo-meta-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.todo-daily-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: var(--radius-full);
  padding: 0.12rem 0.5rem;
  white-space: nowrap;
  user-select: none;
}

.todo-daily-pill .material-symbols-rounded {
  font-size: 13px;
  color: #0284c7;
}

.todo-due-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-container-low);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.12rem 0.5rem;
  white-space: nowrap;
  user-select: none;
}

.todo-due-pill .material-symbols-rounded {
  font-size: 13px;
}

.todo-due-pill.due-today {
  color: #b45309;
  background: #fef3c7;
  border-color: #fde68a;
}

.todo-due-pill.due-today .material-symbols-rounded {
  color: #f59e0b;
}

.todo-due-pill.due-overdue {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}

.todo-due-pill.due-overdue .material-symbols-rounded {
  color: #ef4444;
}

.todo-date-picker-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.todo-date-picker-label:hover {
  color: var(--primary);
  background: var(--surface-container-low);
}

.todo-date-picker-label .material-symbols-rounded {
  font-size: 16px;
}

.todo-date-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  inset: 0;
  cursor: pointer;
}

.todo-action-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  opacity: 0.45;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.todo-action-icon-btn:hover,
.todo-action-icon-btn.is-active {
  opacity: 1;
  color: #0284c7;
}

.todo-action-icon-btn.is-active {
  background: #e0f2fe;
}

.todo-action-icon-btn .material-symbols-rounded {
  font-size: 16px;
}

.todo-inline-daily-btn.is-active {
  color: #0284c7;
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.4);
}

.subject-share-btn {
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.subject-share-btn:hover {
  color: var(--primary);
  background: var(--surface-container-low);
}

.header-toggle-all-btn {
  font-weight: 600;
}

/* Inline Notes in Content Drawer */
.content-notes-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--subject-color, var(--primary));
  transition: border-color var(--m3-duration-short) ease;
}

.content-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.content-notes-header-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.content-notes-header-left .material-symbols-rounded {
  color: var(--primary);
  font-size: 15px;
}

.autosave-micro-hint {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.85;
}

.content-notes-textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 38px;
  outline: none;
  font-family: inherit;
  display: block;
}

.content-notes-textarea:focus {
  background: var(--surface-container-low);
  border-radius: 4px;
  padding: 0.25rem;
}

/* Quick Date Picker in Content Header */
.content-date-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
}

.date-picker-trigger {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  font-size: 0.82rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--primary);
  transition: all var(--m3-duration-short) ease;
}

.date-picker-trigger:hover {
  background: var(--primary-container);
  border-color: var(--primary);
}

.date-picker-trigger .material-symbols-rounded {
  font-size: 16px;
  color: var(--primary);
}

.quick-date-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.add-todo-inline {
  display: flex;
  gap: 0.5rem;
}

.add-todo-input {
  flex: 1;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--m3-duration-short);
}

.add-todo-input:focus {
  border-color: var(--primary);
}

/* Semester Subjects View (Tab 2) */
.semester-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .semester-grid {
    grid-template-columns: 350px 1fr;
  }
}

.form-panel {
  background: var(--bg-surface);
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  height: fit-content;
}

.form-panel h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.color-swatch-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--m3-duration-short), border-color var(--m3-duration-short);
}

.color-swatch-circle:hover {
  transform: scale(1.15);
}

.color-swatch-circle.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

.color-picker-input {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  background: none;
}

/* Subject Material Symbol Icon Palette */
.icon-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  max-height: 155px;
  overflow-y: auto;
  padding: 0.45rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-top: 0.35rem;
}

.icon-opt-btn {
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform var(--m3-duration-short), background var(--m3-duration-short), color var(--m3-duration-short);
}

.icon-opt-btn .material-symbols-rounded {
  font-size: 20px;
}

.icon-opt-btn:hover {
  transform: scale(1.1);
  background: var(--primary-container);
  color: var(--primary);
  border-color: var(--primary);
}

.icon-opt-btn.active {
  border-color: var(--primary);
  background: var(--primary-container);
  color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 0 0 2px rgba(59, 130, 247, 0.25);
}

/* Subject Management List in Tab 2 */
.manage-list-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subject-manage-item {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--card-shadow);
  transition: all var(--m3-duration-short) ease;
}

.subject-manage-item:hover {
  box-shadow: var(--card-shadow-hover);
}

/* Buttons (Material You Expressive) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--m3-duration-short) var(--m3-easing-standard);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn .material-symbols-rounded,
.btn svg,
.btn-icon svg {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(59, 130, 247, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 247, 0.35);
}

.btn-secondary {
  background: var(--surface-container-low);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--surface-container);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: rgba(59, 130, 247, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline:hover .material-symbols-rounded {
  color: var(--primary);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border-color);
}

.btn-danger:hover {
  background: var(--danger-container);
  border-color: #fecaca;
  color: var(--on-danger-container);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--radius-full);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container-low);
  border: 1px solid var(--border-color);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--m3-duration-short) ease;
}

.btn-icon:hover {
  color: var(--primary-hover);
  background: var(--primary-container);
  border-color: var(--primary);
  transform: scale(1.08);
}

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

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--m3-duration-short), box-shadow var(--m3-duration-short);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 247, 0.18);
}

/* Modals (M3 Expressive Dialog) */
.modal-overlay,
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--m3-duration-medium) var(--m3-easing-standard),
              visibility var(--m3-duration-medium) var(--m3-easing-standard);
}

.modal-overlay.is-open,
.modal-overlay.active,
.modal-backdrop.is-open,
.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content,
.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-color);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--elevation-modal);
  transform: translateY(16px) scale(0.96);
  transition: transform var(--m3-duration-medium) var(--m3-easing-emphasized);
}

.modal-overlay.is-open .modal-content,
.modal-overlay.active .modal-content,
.modal-backdrop.is-open .modal-card,
.modal-backdrop.active .modal-card {
  transform: translateY(0) scale(1);
}

.account-header-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.account-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.modal-header {
  padding: 1.35rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem 1.75rem;
}

.modal-footer {
  padding: 1.15rem 1.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--surface-container-low);
  border-bottom-left-radius: var(--radius-2xl);
  border-bottom-right-radius: var(--radius-2xl);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.7rem 1.25rem;
  box-shadow: var(--card-shadow-hover);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  animation: m3SlideUp var(--m3-duration-medium) var(--m3-easing-emphasized);
  pointer-events: auto;
}

.toast .material-symbols-rounded {
  color: var(--primary);
  font-size: 20px;
}

.toast.toast-danger, .toast.toast-error {
  border-color: rgba(239, 68, 68, 0.45);
  background: color-mix(in srgb, #ef4444 8%, var(--bg-surface));
}

.toast.toast-danger .material-symbols-rounded, .toast.toast-error .material-symbols-rounded {
  color: #ef4444;
}

.toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: color-mix(in srgb, #f59e0b 8%, var(--bg-surface));
}

.toast.toast-warning .material-symbols-rounded {
  color: #f59e0b;
}

.toast.toast-success .material-symbols-rounded {
  color: #10b981;
}

/* Animations */
@keyframes m3FadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  border: 2px dashed var(--border-color);
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3.5rem;
  color: var(--primary);
  margin-bottom: 0.85rem;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.empty-state-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 1.5rem;
  line-height: 1.5;
}

/* --- Auth & Cloud Sync (Flashcards PRO Integration) --- */
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
}

.account-avatar-img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
}

.pro-tag-badge {
  background: linear-gradient(135deg, #3b82f7 0%, #1d61e8 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
}

.account-modal-card {
  max-width: 490px;
  border-radius: var(--radius-2xl);
  overflow: hidden;
}

.account-modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.account-user-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--surface-container-low);
  border-radius: var(--radius-xl);
}

.account-user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.account-user-avatar-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-container);
  color: var(--on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.account-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-user-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-user-email {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-plan-box {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--surface-container-lowest);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.account-plan-box.is-pro {
  background: linear-gradient(145deg, rgba(59, 130, 247, 0.08) 0%, rgba(30, 58, 138, 0.04) 100%);
  border-color: rgba(59, 130, 247, 0.35);
}

.account-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-plan-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-plan-badge-pro {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #3b82f7 0%, #1d61e8 100%);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.account-plan-badge-free {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-container);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.account-plan-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.account-cloud-box {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  background: var(--surface-container-lowest);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.account-cloud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-cloud-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cloud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.cloud-dot.active {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.cloud-dot.syncing {
  background: var(--primary);
  animation: pulseDot 1.2s infinite ease-in-out;
}

.account-cloud-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.account-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

