/* ===================================================================
   LAYOUT & NOTEBOOK SHELL
   Desk canvas, notebook binder, spiral rings, bookmark ribbons & tabs
   =================================================================== */

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

html, body {
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-desk);
  color: var(--text-main);
  transition: background-color var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Base desk wrapper */
.desk-canvas {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--space-md) var(--space-2xl);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(200, 180, 160, 0.12), transparent 70%);
  position: relative;
  overflow-x: hidden;
}

[data-theme="dark"] .desk-canvas {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(60, 70, 85, 0.15), transparent 70%);
}

/* Desk Top Control Bar */
.desk-header {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-paper);
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: rotate(-3deg);
  transition: transform var(--transition-fast);
}
.brand-icon:hover {
  transform: rotate(0deg) scale(1.05);
}

.brand-info h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-info p {
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--accent-primary);
  line-height: 1;
}

/* Header Live Time Badge */
.header-clock-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  background: var(--bg-paper-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-body);
}

.header-clock-badge .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-sage);
  box-shadow: 0 0 6px var(--accent-sage);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.3); opacity: 0.5; }
}

/* Header Controls & Theme Switcher */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

/* Theme segmented control */
.theme-switch-group {
  display: inline-flex;
  align-items: center;
  background: var(--pill-bg);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.theme-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}

.theme-pill-btn:hover {
  color: var(--text-main);
}

.theme-pill-btn.active {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.theme-auto-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 0 6px;
  white-space: nowrap;
}

/* Tactile Icon Button */
.icon-action-btn {
  background: var(--bg-paper-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.icon-action-btn:hover {
  background: var(--bg-card);
  color: var(--accent-primary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.icon-action-btn.active {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ===================================================================
   MAIN NOTEBOOK SHELL
   The Physical Book Experience
   =================================================================== */
.notebook-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Notebook Cover & Spiral Ribbon Tabs Bar */
.notebook-tabs-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-left: var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 10;
}
.notebook-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.notebook-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 8px;
  background: var(--bg-paper-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.notebook-tab:hover {
  color: var(--text-main);
  background: var(--bg-card);
  transform: translateY(-2px);
}

.notebook-tab.active {
  background: var(--bg-paper);
  color: var(--accent-primary);
  border-color: var(--border-strong);
  font-weight: 700;
  padding-bottom: 12px;
  margin-bottom: -4px;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.04);
  z-index: 15;
}

/* Little color indicator for each tab like colored tab dividers */
.notebook-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 0 0 2px 2px;
  background: transparent;
  transition: background var(--transition-fast);
}

.notebook-tab[data-tab="todos"]::before { background: var(--accent-secondary); }
.notebook-tab[data-tab="notdos"]::before { background: var(--accent-crimson); }
.notebook-tab[data-tab="daily"]::before { background: var(--accent-mustard); }
.notebook-tab[data-tab="calendar"]::before { background: var(--accent-sage); }
.notebook-tab[data-tab="pomodoro"]::before { background: var(--accent-primary); }
.notebook-tab[data-tab="stickies"]::before { background: var(--accent-violet); }

.notebook-tab .tab-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--pill-bg);
  color: var(--text-muted);
}
.notebook-tab.active .tab-badge {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

/* The Notebook Body Sheet */
.notebook-book {
  position: relative;
  background: var(--bg-paper);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  min-height: 720px;
  display: flex;
  flex-direction: column;
}

/* Spiral rings binding imitation on the left for luxury notebook feel */
.notebook-spiral-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.05), transparent);
  border-right: 1px dashed var(--border-subtle);
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
}

[data-theme="dark"] .notebook-spiral-strip {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.4), transparent);
}

.tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .notebook-tab {
  background: #15181E;
  border-color: rgba(255, 255, 255, 0.08);
  color: #8D8980;
}

[data-theme="dark"] .notebook-tab:hover {
  background: #1C2028;
  color: #F5F3ED;
}

[data-theme="dark"] .notebook-tab.active {
  background: var(--bg-paper);
  color: var(--accent-primary);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.6);
}

.spiral-ring {
  width: 16px;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(135deg, #E2DDD5 0%, #A8A096 50%, #756D63 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(50, 40, 30, 0.25);
}

[data-theme="dark"] .spiral-ring {
  background: linear-gradient(135deg, #4A5160 0%, #252932 50%, #15181E 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Notebook Page Content Area */
.notebook-page {
  padding: var(--space-xl) var(--space-xl) var(--space-xl) calc(var(--space-xl) + 26px);
  flex: 1;
  display: none;
  position: relative;
  background-color: var(--bg-paper);
  background-image: 
    radial-gradient(var(--grid-line) 1px, transparent 1px);
  background-size: 20px 20px;
}

.notebook-page.active {
  display: block;
  animation: pageFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Red Left Margin Line (Classic ruled notebook margin) */
/* Page Margin Line Removed to prevent clipping content */

/* Notebook Page Header with Washi Tape */
.page-header {
  position: relative;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.page-header-title-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-subtitle {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .desk-canvas {
    padding: var(--space-xs);
  }
  .notebook-spiral-strip {
    display: none;
  }
  .notebook-page {
    padding: var(--space-md);
  }
  .notebook-tab {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}
