/* ===== STUDENT PRODUCTIVITY HUB – DESIGN SYSTEM ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Primary palette */
  --primary: #6C5CE7;
  --primary-light: #a29bfe;
  --primary-dark: #4834d4;
  --secondary: #00cec9;
  --secondary-light: #81ecec;
  --accent: #fd79a8;
  --accent-light: #fab1a0;
  --warning: #fdcb6e;
  --success: #00b894;
  --danger: #d63031;
  --info: #0984e3;

  /* Surfaces */
  --bg: #f8f9fd;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f3f8;
  --bg-hover: #eef0f7;
  --bg-modal: rgba(0, 0, 0, 0.45);

  /* Text */
  --text: #2d3436;
  --text-secondary: #636e72;
  --text-muted: #b2bec3;
  --text-inverse: #ffffff;

  /* Borders & Shadows */
  --border: #dfe6e9;
  --border-light: #eef1f5;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 4px 20px rgba(108, 92, 231, 0.10);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);

  /* Radii */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 50%;

  /* Spacing */
  --gap: 16px;
  --gap-lg: 24px;

  /* Transitions */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #6C5CE7, #a29bfe);
  --grad-secondary: linear-gradient(135deg, #00cec9, #81ecec);
  --grad-accent: linear-gradient(135deg, #fd79a8, #fab1a0);
  --grad-warm: linear-gradient(135deg, #fdcb6e, #f39c12);
  --grad-hero: linear-gradient(135deg, #6C5CE7 0%, #a29bfe 50%, #81ecec 100%);
  --grad-card-study: linear-gradient(135deg, #6C5CE7, #a29bfe);
  --grad-card-homework: linear-gradient(135deg, #0984e3, #74b9ff);
  --grad-card-time: linear-gradient(135deg, #00cec9, #55efc4);
  --grad-card-helper: linear-gradient(135deg, #fdcb6e, #f39c12);
  --grad-card-parent: linear-gradient(135deg, #fd79a8, #e84393);

  /* Sidebar */
  --sidebar-width: 260px;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #1e1e35;
  --bg-input: #252542;
  --bg-hover: #2a2a4a;
  --text: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6c6c88;
  --border: #2e2e4d;
  --border-light: #252542;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 4px 20px rgba(108, 92, 231, 0.15);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.25);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 0.95rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--bg-input);
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
  transform: translateY(-1px);
}

img {
  max-width: 100%;
  display: block;
}

ul,
ol {
  list-style: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 10px;
}

/* ---------- Header / Top Bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
}

.topbar-brand svg {
  width: 32px;
  height: 32px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions button,
.topbar-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--transition);
}

.topbar-actions button:hover,
.topbar-actions a:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.hamburger {
  display: none;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 900;
  padding: 20px 0;
  transition: transform var(--transition), background var(--transition);
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 8px 24px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
}

.sidebar-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  transition: height var(--transition);
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--bg-hover);
  color: var(--primary);
}

.sidebar-link.active::before {
  height: 60%;
}

.sidebar-link svg,
.sidebar-link .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ---------- Main Content ---------- */
.main {
  margin-left: var(--sidebar-width);
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  padding: 32px;
  transition: margin var(--transition);
}

/* ---------- Hero Section ---------- */
.hero {
  background: var(--grad-hero);
  border-radius: var(--radius-xl);
  padding: 60px 48px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 48px;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 350px;
  height: 350px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  margin-bottom: 28px;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  text-align: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-white {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
}

.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #fff;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 5px 12px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--primary);
  color: #fff;
}

/* ---------- Section Headings ---------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 4px;
  -webkit-text-fill-color: var(--text-secondary);
}

/* ---------- Category Cards (Homepage) ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap-lg);
  margin-bottom: 48px;
}

.category-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.category-card[data-cat="study"]::before {
  background: var(--grad-card-study);
}

.category-card[data-cat="homework"]::before {
  background: var(--grad-card-homework);
}

.category-card[data-cat="time"]::before {
  background: var(--grad-card-time);
}

.category-card[data-cat="helper"]::before {
  background: var(--grad-card-helper);
}

.category-card[data-cat="parent"]::before {
  background: var(--grad-card-parent);
}

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.category-card .cat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 18px;
  color: #fff;
}

.category-card[data-cat="study"] .cat-icon {
  background: var(--grad-card-study);
}

.category-card[data-cat="homework"] .cat-icon {
  background: var(--grad-card-homework);
}

.category-card[data-cat="time"] .cat-icon {
  background: var(--grad-card-time);
}

.category-card[data-cat="helper"] .cat-icon {
  background: var(--grad-card-helper);
}

.category-card[data-cat="parent"] .cat-icon {
  background: var(--grad-card-parent);
}

.category-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.category-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.category-card .cat-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 14px;
}

/* ---------- Tool Cards (Dashboard) ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--primary-light);
}

.tool-card .tool-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
}

.tool-card[data-cat="study"] .tool-icon {
  background: var(--grad-card-study);
}

.tool-card[data-cat="homework"] .tool-icon {
  background: var(--grad-card-homework);
}

.tool-card[data-cat="time"] .tool-icon {
  background: var(--grad-card-time);
}

.tool-card[data-cat="helper"] .tool-icon {
  background: var(--grad-card-helper);
}

.tool-card[data-cat="parent"] .tool-icon {
  background: var(--grad-card-parent);
}

.tool-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.tool-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex: 1;
}

.tool-card .tool-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  opacity: 0.7;
}

/* ---------- Search Bar ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 6px 6px 18px;
  margin-bottom: 28px;
  transition: border var(--transition);
  max-width: 500px;
}

.search-bar:focus-within {
  border-color: var(--primary);
}

.search-bar input {
  border: none;
  background: none;
  padding: 10px 0;
}

.search-bar input:focus {
  box-shadow: none;
}

.search-bar .search-icon {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ---------- Filter Tabs ---------- */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.filter-tab {
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-secondary);
  transition: all var(--transition);
  border: 2px solid transparent;
}

.filter-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.filter-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.25);
}

/* ---------- Tool View Container — Premium ---------- */
.tool-view {
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  padding: 32px;
  animation: fadeSlideUp 0.35s ease-out;
  position: relative;
  overflow: hidden;
}

.tool-view::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--secondary));
  opacity: 0.8;
}

.tool-view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tool-view-header .back-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bg-input), var(--bg-card));
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-view-header .back-btn:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.25);
  transform: translateY(-2px);
}

.tool-view-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tool-view-header .tool-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ---------- Forms Inside Tools — Clean ---------- */
.tool-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.form-row>* {
  flex: 1;
  min-width: 150px;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ---------- Data Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  background: var(--bg-input);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table .table-actions {
  display: flex;
  gap: 6px;
}

/* ---------- Status Badges — Premium ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-pending {
  background: rgba(253, 203, 110, 0.15);
  color: #d68910;
  border-color: rgba(253, 203, 110, 0.3);
}

.badge-in-progress {
  background: rgba(116, 185, 255, 0.15);
  color: #0652DD;
  border-color: rgba(116, 185, 255, 0.3);
}

.badge-completed {
  background: rgba(85, 239, 196, 0.15);
  color: #00b894;
  border-color: rgba(85, 239, 196, 0.3);
}

.badge-overdue {
  background: rgba(250, 177, 160, 0.15);
  color: #d63031;
  border-color: rgba(250, 177, 160, 0.3);
}

/* ---------- Progress Bar — Premium ---------- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar .fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: progressShimmer 2s ease infinite;
}

@keyframes progressShimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* ---------- Timer Display ---------- */
.timer-display {
  font-size: 4rem;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  color: var(--primary);
  margin: 24px 0;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* ---------- Flashcard ---------- */
.flashcard-container {
  perspective: 1000px;
  margin: 24px auto;
  max-width: 400px;
}

.flashcard {
  width: 100%;
  min-height: 220px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border-radius: var(--radius-lg);
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
}

.flashcard-front {
  background: var(--grad-primary);
  color: #fff;
}

.flashcard-back {
  background: var(--grad-secondary);
  color: #fff;
  transform: rotateY(180deg);
}

/* ---------- Focus Mode ---------- */
.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0f0f1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.focus-overlay .focus-timer {
  font-size: 6rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.focus-overlay .focus-message {
  font-size: 1.3rem;
  opacity: 0.6;
  margin-top: 12px;
}

.focus-overlay .focus-exit {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
}

.focus-overlay .focus-exit:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Calculator ---------- */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
}

.calc-btn {
  padding: 18px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text);
  transition: all var(--transition);
}

.calc-btn:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

.calc-btn.operator {
  background: var(--primary);
  color: #fff;
}

.calc-btn.operator:hover {
  background: var(--primary-dark);
}

.calc-btn.equals {
  background: var(--success);
  color: #fff;
}

.calc-btn.clear {
  background: var(--danger);
  color: #fff;
}

.calc-display {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 2rem;
  font-weight: 700;
  text-align: right;
  margin-bottom: 16px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  word-break: break-all;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Habit Tracker Grid ---------- */
.habit-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(7, 1fr);
}

.habit-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-input);
  transition: background var(--transition);
  cursor: pointer;
  min-width: 20px;
}

.habit-cell.done {
  background: var(--success);
}

.habit-cell.partial {
  background: #fdcb6e;
}

/* ---------- Timetable Grid ---------- */
.timetable {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 2px;
  font-size: 0.82rem;
}

.timetable-cell {
  padding: 10px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timetable-header {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
}

.timetable-time {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
}

/* ---------- Quote Card ---------- */
.quote-card {
  background: var(--grad-primary);
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  color: #fff;
  text-align: center;
  max-width: 600px;
  margin: 24px auto;
  position: relative;
}

.quote-card .quote-text {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 16px;
  font-style: italic;
}

.quote-card .quote-author {
  font-size: 0.95rem;
  opacity: 0.8;
}

.quote-card .quote-icon {
  font-size: 3rem;
  opacity: 0.15;
  position: absolute;
  top: 16px;
  left: 24px;
}

/* ---------- Stats Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--gap);
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-light);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 900;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- Empty State — Premium ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.02), rgba(0, 206, 201, 0.02));
  border: 1.5px dashed rgba(108, 92, 231, 0.12);
  border-radius: 20px;
}

.empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: var(--bg-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.3s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeSlideUp 0.3s ease-out;
  min-width: 260px;
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--info);
}

/* ---------- List Items — Dramatic Premium ---------- */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 16px;
  border-top: 3px solid var(--primary);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.02);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-card);
  border-radius: 16px;
  border-left: 4px solid var(--primary-light);
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-row:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.12), 0 4px 10px rgba(0, 0, 0, 0.06);
  border-left-color: var(--primary);
}

/* Checkbox — Bold Circle */
.item-row .item-check {
  width: 28px;
  height: 28px;
  border: 2.5px solid #c5cad3;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  color: transparent;
  font-size: 0.75rem;
  background: var(--bg-card);
}

.item-row .item-check:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
  transform: scale(1.1);
}

.item-row .item-check.checked {
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(108, 92, 231, 0.3);
  transform: scale(1.05);
}

/* Content */
.item-row .item-content {
  flex: 1;
  min-width: 0;
}

.item-row .item-content.done {
  opacity: 0.35;
}

.item-row .item-content.done .item-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
  text-decoration-thickness: 2px;
}

.item-row .item-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.item-row .item-meta {
  font-size: 0.82rem;
  color: var(--primary-dark);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 500;
  opacity: 0.7;
}

/* Actions */
.item-row .item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.item-row .item-actions .btn-danger,
.item-row .item-actions .btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 700;
}

.item-row .item-actions .btn-danger:hover,
.item-row .item-actions .btn-icon:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.item-row .item-actions .btn-xs {
  border-radius: 12px;
  font-size: 0.82rem;
  padding: 8px 18px;
  font-weight: 700;
  transition: all 0.25s ease;
}

.item-row .item-actions .btn-xs:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

/* Dark mode */
[data-theme="dark"] .item-list {
  background: rgba(255, 255, 255, 0.03);
  border-top-color: var(--primary-light);
}

[data-theme="dark"] .item-row {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-left-color: var(--primary);
}

[data-theme="dark"] .item-row:hover {
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.15), 0 4px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .item-row .item-check {
  border-color: #4a4a6a;
  background: var(--bg-input);
}

[data-theme="dark"] .item-row .item-meta {
  color: var(--primary-light);
}

[data-theme="dark"] .item-row .item-actions .btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

[data-theme="dark"] .item-row .item-actions .btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
}

.item-row .item-actions .btn-xs:hover {
  transform: translateY(-1px);
}

/* Dark mode */
[data-theme="dark"] .item-list {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .item-row {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .item-row .item-check {
  border-color: #404060;
}

[data-theme="dark"] .item-row .item-actions .btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

[data-theme="dark"] .item-row .item-actions .btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

/* Notif items premium */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: all 0.3s;
}

.notif-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
}

/* ---------- Tab Navigation Inside Tools ---------- */
.tool-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-light);
}

.tool-tab {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tool-tab:hover {
  color: var(--text);
}

.tool-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---------- Homepage Feature Section ---------- */
.features-section {
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap-lg);
}

.feature-card {
  text-align: center;
  padding: 36px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.feature-card .feature-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 18px;
  background: var(--grad-primary);
  color: #fff;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 48px;
}

.footer a {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- Notifications Container ---------- */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}

.notif-item .notif-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.notif-item .notif-text {
  font-size: 0.9rem;
  flex: 1;
}

/* ---------- Countdown ---------- */
.countdown-grid {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0;
}

.countdown-unit {
  background: var(--grad-primary);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  color: #fff;
  min-width: 80px;
}

.countdown-unit .unit-value {
  font-size: 2.5rem;
  font-weight: 900;
}

.countdown-unit .unit-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-in {
  animation: fadeSlideUp 0.4s ease-out;
}

/* ---------- Print Styles ---------- */
@media print {

  .topbar,
  .sidebar,
  .tool-view-header .back-btn,
  .tool-view-header .tool-actions,
  .toast-container {
    display: none !important;
  }

  .main {
    margin: 0 !important;
    padding: 20px !important;
  }

  .tool-view {
    box-shadow: none !important;
    border: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 20px 16px;
  }

  .hero {
    padding: 40px 28px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .tool-view {
    padding: 20px 16px;
  }

  .tool-view-header h2 {
    font-size: 1.15rem;
  }

  .timer-display {
    font-size: 3rem;
  }

  .section-header h2 {
    font-size: 1.3rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
  }

  .data-table {
    font-size: 0.82rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }

  .timetable {
    font-size: 0.72rem;
  }

  .focus-overlay .focus-timer {
    font-size: 4rem;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 16px;
  }

  .topbar-brand {
    font-size: 1.05rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .tools-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .tool-card {
    padding: 16px;
  }

  .tool-card .tool-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .tool-card h4 {
    font-size: 0.85rem;
  }

  .calc-grid {
    max-width: 280px;
  }

  .countdown-unit {
    padding: 14px 16px;
    min-width: 64px;
  }

  .countdown-unit .unit-value {
    font-size: 1.8rem;
  }
}

/* Overlay for sidebar on mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 899;
  background: rgba(0, 0, 0, 0.3);
  display: none;
}

.sidebar-overlay.show {
  display: block;
}

/* Utility */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mb-1 {
  margin-bottom: 8px;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-1 {
  gap: 8px;
}

.gap-2 {
  gap: 16px;
}

.w-full {
  width: 100%;
}

.overflow-x {
  overflow-x: auto;
}