@tailwind base;
@tailwind components;
@tailwind utilities;

/* Global Styles */

:root {
  --weekly-font: var(--font-body, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif);
  --weekly-font-headline: var(--font-headline, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif);
  --font-weight-body: 400;
}

/* Reset and base styles */
*,
::before,
::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: transparent;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: var(--weekly-font);
  font-weight: var(--font-weight-body);
}

body {
  background-color: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
  transition: background-color 0.3s ease;
}

/* Typography */
h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  color: #0f172a;
  font-weight: 700;
}

h2 {
  font-size: 1.875rem;
  margin-bottom: 0.75rem;
  color: #0f172a;
  font-weight: 600;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
  font-weight: 600;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  background-color: #94a3b8;
  color: white;
}

.btn-secondary:hover {
  background-color: #64748b;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
}

.btn-outline:hover {
  background-color: #f1f5f9;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: #334155;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* Task List */
.task-list {
  list-style: none;
}

.task-list li {
  margin-bottom: 0.5rem;
}

/* Task Item */
.task-item {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #e2e8f0;
}

.task-item:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.task-item.completed {
  opacity: 0.7;
}

.task-item h4 {
  margin: 0 0 0.5rem 0;
  color: #0f172a;
}

.task-item p {
  margin: 0 0 0.5rem 0;
  color: #64748b;
}

.weekly-auth-recommended {
  font-size: 0.85rem;
  color: #475569;
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 500;
}

.time-indicator {
  font-size: 0.875rem;
  color: #3b82f6;
  font-weight: 500;
}

/* Weekly Calendar View */
.weekly-calendar-view {
  margin-top: 2rem;
}

.calendar-header {
  margin-bottom: 1.5rem;
}

.week-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.nav-button {
  padding: 0.5rem 1rem;
  background-color: #f1f5f9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.weekly-btn-primary {
  background-color: var(--weekly-teal);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-button:hover {
  background-color: #e2e8f0;
  transform: translateY(-1px);
}

.week-range {
  font-weight: 600;
  font-size: 1.125rem;
  color: #1e293b;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
}

.day-column {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.day-column:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.day-header {
  background-color: #3b82f6;
  color: white;
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
}

.day-content {
  padding: 1rem;
  min-height: 200px;
}

/* Task Form */
.task-form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  border: 1px solid #e2e8f0;
}

.submit-button {
  background-color: #22c55e;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  width: 100%;
}

.submit-button:hover {
  background-color: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: #64748b;
  background-color: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* Calendar Events */
.calendar-event {
  border-left-width: 4px;
  border-left-style: solid;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border-radius: 0 6px 6px 0;
  background-color: #f8fafc;
  transition: all 0.2s ease;
}

.calendar-event:hover {
  transform: translateX(2px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.auth-form {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  border-top-color: #3b82f6;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .calendar-grid {
    grid-template-columns: repeat(1, 1fr);
  }

  .week-navigation {
    flex-direction: column;
    gap: 0.5rem;
  }

  .week-range {
    font-size: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .day-header {
    font-size: 0.875rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #0f172a;
    color: #f8fafc;
  }

  h1,
  h2,
  h3 {
    color: #f8fafc;
  }

  .task-item,
  .task-form,
  .day-column,
  .calendar-settings,
  .auth-form {
    background-color: #1e293b;
    border-color: #334155;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
  }

  .nav-button {
    background-color: #334155;
    color: #f8fafc;
  }

  .nav-button:hover {
    background-color: #475569;
  }

  .empty-state {
    background-color: #1e293b;
    border-color: #334155;
    color: #94a3b8;
  }

  .calendar-event {
    background-color: #1e293b;
    border-color: #334155;
  }
}

/* ============================================
   TEUXDEUX STYLES
   ============================================ */

:root {
  --weekly-teal: #009a9a;
  --weekly-bg: #ffffff;
  --weekly-text: #000000;
  --weekly-text-light: #a6a6a7;
  --weekly-border: #cccccc;
  --weekly-completed: #cccccc;
  --weekly-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Settings Sidebar Theme */
  --weekly-settings-bg: white;
  --weekly-settings-item-bg: #f8fafc;
  --weekly-settings-label: #475569;
  --weekly-settings-title: #111827;
  --weekly-settings-input-bg: white;
  --weekly-settings-input-border: #dddddd;
  --weekly-settings-text: #111827;
  --weekly-settings-toggle-bg: #f3f4f6;
  --weekly-settings-toggle-active-bg: white;
  --weekly-settings-toggle-text: #6b7280;
  --weekly-settings-toggle-active-text: #111827;
  --weekly-header-brightness: 1;
  --weekly-goal-brightness: 1;
}

/* Weekly Main Container */
.weekly-container {
  height: 100vh;
  background: var(--weekly-bg);
  font-family: var(--weekly-font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Weekly Header */
.weekly-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--weekly-bg);
  border-bottom: 1px solid var(--weekly-border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  flex-shrink: 0;
}
.weekly-logo {
  flex-shrink: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--weekly-text);
}

.weekly-logo sup {
  color: var(--weekly-teal);
  font-size: 0.75rem;
}

.weekly-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.weekly-nav-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--weekly-text-light);
  font-size: 1rem;
  transition: color 0.15s ease;
}

.weekly-nav-btn:hover {
  color: var(--weekly-text);
}

/* Week Number Display */
.weekly-week-number {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--weekly-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Slide Animations - Two-phase animation: slide out then slide in */
/* Slide OUT animations (current content exits) */
@keyframes slideOutLeft {
  0% {
    transform: translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateX(-100px);
    opacity: 0;
  }
}

@keyframes slideOutRight {
  0% {
    transform: translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateX(100px);
    opacity: 0;
  }
}



/* Weekly Day Columns Grid */
.weekly-days-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  flex: 1;
  min-height: 0;
}

.weekly-days-grid.cols-1 {
  grid-template-columns: 1fr;
}

.weekly-days-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.weekly-days-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.weekly-days-grid.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.weekly-days-grid.cols-7 {
  grid-template-columns: repeat(7, 1fr);
}

/* Weekly Day Column */
.weekly-day-column {
  border-left: 1px solid #eee;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.weekly-day-column:first-child {
  border-left: none;
}

/* Weekend Styling */
.weekly-day-column.is-sat .weekly-day-name {
  color: var(--weekly-weekend-sat, #666);
}

.weekly-day-column.is-sun .weekly-day-name {
  color: var(--weekly-weekend-sun, #dc2626);
}

.weekly-day-column.is-today {
  background-color: var(--weekly-today-highlight);
}

.weekly-day-column.is-past .weekly-day-name,
.weekly-day-column.is-past .weekly-day-date {
  color: var(--weekly-past-color, #a6a6a7);
}

/* Day Header */
.weekly-day-header {
  padding: 8px 0;
  text-align: left;
  min-height: auto;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--weekly-bg, white);
}

.weekly-day-date {
  font-size: var(--weekly-date-size, 0.65rem);
  font-weight: var(--weekly-date-weight, 400);
  color: var(--weekly-date-color, var(--weekly-text-light));
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
  line-height: 1.2;
  font-family: var(--weekly-date-font, var(--weekly-font-headline)) !important;
}

.weekly-day-name {
  font-size: var(--weekly-headline-size, 1.25rem);
  font-weight: var(--weekly-headline-weight, 900);
  letter-spacing: -0.02em;
  color: var(--weekly-weekday-color, var(--weekly-text));
  font-family: var(--weekly-font-headline) !important;
  margin: 0;
  line-height: 1.1;
}

.weekly-day-name.is-today {
  color: var(--weekly-teal);
}

/* Task List */
.weekly-task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.weekly-task-item {
  padding: 0.25rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--weekly-border); /* Restore lines */
  line-height: 1.4;
  height: auto;
  min-height: 32px;
}

/* Remove border from last item to look cleaner, or keep for paper look */
.weekly-task-list .weekly-task-item:last-child {
  border-bottom: 1px solid transparent; 
}

.weekly-task-item:hover {
  background-color: rgba(0,0,0,0.02);
  z-index: 10;
}

.weekly-task-item.completed {
  opacity: 0.6;
}

.weekly-task-item.completed .weekly-task-text {
  text-decoration: line-through;
  color: var(--weekly-completed);
}

.weekly-task-item.completed-with-checkbox .weekly-task-text {
  opacity: 0.7;
}

.task-checkbox {
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid var(--weekly-border);
  transition: all 0.2s;
}

.task-checkbox:checked {
  background-color: var(--weekly-teal);
  border-color: var(--weekly-teal);
}

.weekly-task-text {
  flex: 1;
  font-family: var(--weekly-task-font, var(--weekly-font));
  font-size: var(--weekly-task-size, 0.9rem);
  font-weight: var(--weekly-task-weight, 400);
  line-height: var(--weekly-task-line-height, 1.5);
  color: var(--weekly-task-color, var(--weekly-text));
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  min-height: 1.5em;
  padding-top: 2px; /* Align with icons */
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

/* Task Actions Visibility - Unified for Weekly and Time Grid */
.weekly-task-item .task-actions,
.time-slot-task .task-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s;
  visibility: hidden;
}

.weekly-task-item:hover .task-actions,
.time-slot-task:hover .task-actions {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.weekly-task-text.completed {
  text-decoration: line-through;
  color: var(--weekly-completed);
}

.weekly-task-text::placeholder {
  color: var(--weekly-text-light);
}

/* Inline Notes */
.weekly-notes-inline {
  width: 100%;
  margin-top: 6px;
  padding: 0;
  animation: notesSlideIn 0.2s ease-out;
}
@keyframes notesSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.weekly-notes-editor-inline {
  width: 100%;
  min-height: 60px;
  max-height: 200px;
  padding: 8px 10px;
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--weekly-text);
  background: var(--weekly-bg, #fff);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dark-mode .weekly-notes-editor-inline {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Floating Notes Popup */
.weekly-notes-popup {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  min-width: 250px;
  background: var(--weekly-bg);
  border: 1px solid var(--weekly-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 8px;
  cursor: default;
}

/* Arrow default (pointing up, when popup is below) */
.weekly-notes-popup::before {
  content: "";
  position: absolute;
  left: 20px;
  top: -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--weekly-border);
}

.weekly-notes-popup::after {
  content: "";
  position: absolute;
  left: 20px;
  top: -7px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--weekly-bg);
}

/* Arrow when popup is above (pointing down) */
.weekly-notes-popup.on-top::before {
  top: auto !important;
  bottom: -8px !important;
  border-bottom: none !important;
  border-top: 8px solid var(--weekly-border) !important;
}

.weekly-notes-popup.on-top::after {
  top: auto !important;
  bottom: -7px !important;
  border-bottom: none !important;
  border-top: 8px solid var(--weekly-bg) !important;
}

.weekly-container.dark-mode .weekly-notes-popup {
  background: #2a2a2a;
  border-color: #444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.weekly-container.dark-mode .weekly-notes-popup::before {
  border-bottom-color: #444;
}

.weekly-container.dark-mode .weekly-notes-popup::after {
  border-bottom-color: #2a2a2a;
}

.weekly-container.dark-mode .weekly-notes-popup.on-top::before {
  border-top-color: #444 !important;
}

.weekly-container.dark-mode .weekly-notes-popup.on-top::after {
  border-top-color: #2a2a2a !important;
}

.weekly-notes-editor-inline:focus {
  border-color: var(--weekly-teal);
  box-shadow: 0 0 0 2px rgba(0, 154, 154, 0.1);
}
.dark-mode .weekly-notes-editor-inline:focus {
  box-shadow: 0 0 0 2px rgba(0, 154, 154, 0.15);
}

/* Rolling Indicator */
/* Note icon on tasks with notes */
.task-note-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--weekly-teal, #009a9a);
  opacity: 0.6;
  margin-right: 2px;
  position: relative;
  cursor: default;
}

.task-note-icon:hover {
  opacity: 1;
}

.task-note-icon:hover::after {
  content: attr(data-note);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--weekly-bg, #fff);
  color: var(--weekly-text, #333);
  border: 1px solid var(--weekly-border, #ddd);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 400;
  white-space: pre-wrap;
  max-width: 250px;
  max-height: 150px;
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
  line-height: 1.4;
}

.rolling-icon-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  color: var(--weekly-teal);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  padding: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  opacity: 0.8;
  pointer-events: none; /* Just visual */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Notes Toolbar */
.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
  padding: 3px 4px;
  background: var(--weekly-settings-toggle-bg, #f3f4f6);
  border-radius: 6px;
}
.dark-mode .notes-toolbar {
  background: rgba(255, 255, 255, 0.06);
}

.notes-toolbar-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--weekly-text-light);
  font-size: 0.75rem;
  padding: 3px 7px;
  border-radius: 4px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: background 0.1s, color 0.1s;
}
.notes-toolbar-btn:hover {
  background: var(--weekly-bg, #fff);
  color: var(--weekly-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.dark-mode .notes-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Action Buttons Styling - Float above task on hover */
.task-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  position: absolute;
  left: 0;
  right: auto;
  top: -28px;
  background: var(--weekly-bg, white);
  border: 1px solid var(--weekly-border, #e0e0e0);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 20;
  padding: 2px 4px;
  flex-wrap: nowrap;
  pointer-events: auto;
}

/* Time-grid tasks: show actions above task text as a floating toolbar on hover */
.time-slot-task > .task-actions {
  position: absolute;
  top: -28px; /* Float above the task */
  left: 0;
  right: auto;
  margin-top: 0;
  background: var(--weekly-bg, white);
  border: 1px solid var(--weekly-border, #e0e0e0);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 2px 4px;
  z-index: 100; /* Ensure it stays above everything */
  display: flex !important; /* Force flex even if default is hidden */
  pointer-events: auto;
}

/* Ensure actions don't get clipped by the scrolling container */
.time-slots-container,
.time-column-slots {
  overflow-y: auto;
  overflow-x: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.time-slots-container::-webkit-scrollbar,
.time-column-slots::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.dark .time-slot-task > .task-actions {
  background: #2a2a2a;
  border-color: #404040;
}

.task-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  width: 22px;
  height: 22px;
  color: var(--weekly-text-light);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.task-action-btn:hover {
  background-color: rgba(0,0,0,0.05);
  color: var(--weekly-text);
}

.dark .task-action-btn:hover {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

/* Specific button styles */
.task-action-btn.delete:hover {
  color: #ef4444; /* Red for delete */
}

.task-action-btn.active {
  color: var(--weekly-teal);
}

/* Sub-tasks */
/* Subtask list — animated expand/collapse */
.subtask-list {
  list-style: none;
  padding: 4px 0 4px 12px;
  margin: 2px 0 0 0;
  border-left: 2px solid var(--weekly-border, #e5e7eb);
  margin-left: 6px;
  animation: subtaskSlideIn 0.2s ease-out;
}
@keyframes subtaskSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 4px;
  font-size: 0.8rem;
  color: var(--weekly-text);
  position: relative;
  cursor: grab;
  border-radius: 4px;
  transition: background 0.1s;
}
.subtask-item:hover {
  background: rgba(0, 0, 0, 0.03);
}
.dark-mode .subtask-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.subtask-item:active {
  cursor: grabbing;
}

.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  opacity: 0.4;
}

.subtask-checkbox {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--weekly-text-muted, #999);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}
.subtask-checkbox:hover {
  color: var(--weekly-teal);
  transform: scale(1.15);
}
.subtask-item.completed .subtask-checkbox {
  color: var(--weekly-teal);
}

.subtask-title {
  flex: 1;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.1s;
}
.subtask-title:hover {
  color: var(--weekly-teal);
}

.subtask-edit-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--weekly-text);
  padding: 0;
}

.subtask-delete-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--weekly-text-muted, #999);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  border-radius: 3px;
}
.subtask-item:hover .subtask-delete-btn {
  opacity: 0.6;
}
.subtask-delete-btn:hover {
  color: #ef4444;
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.08);
}

.subtask-add-row {
  padding: 2px 0 4px 12px;
  margin-left: 6px;
  border-left: 2px solid var(--weekly-border, #e5e7eb);
}

.subtask-add-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--weekly-text);
  padding: 2px 0;
}
.subtask-add-input::placeholder {
  color: var(--weekly-text-muted, #999);
  font-style: italic;
  opacity: 0.7;
}

/* Task Input */
.weekly-task-input {
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border-bottom: none;
}

.weekly-task-input input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--weekly-text);
  background: transparent;
}

.weekly-task-input input::placeholder {
  color: var(--weekly-text-light);
}

/* Someday Section */
.weekly-someday {
  background-color: #f9f9f9;
  width: 100%;
  padding: 0 1rem;
  position: relative;
  flex-shrink: 0;
}

.weekly-container.dark-mode .weekly-someday {
  background-color: #1a1a1b; 
}

.weekly-someday.collapsed {
  height: 30px !important;
  min-height: 30px;
  max-height: 30px;
  overflow: hidden;
}

.weekly-someday.expanded {
  overflow: auto;
}

.weekly-someday-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  position: relative;
}

.weekly-someday-toggle {
  background: none;
  border: none;
  font-size: 0.875rem;
  color: var(--weekly-text-light);
  cursor: pointer;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.5rem;
  transition: transform 0.2s ease;
}

.weekly-someday-toggle:hover {
  color: var(--weekly-text);
}

/* Removed rogue color override for weekly-day-name */
.weekly-day-name {
  /* color: var(--weekly-text-light); */
}

.weekly-someday-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--weekly-text-light);
}

.weekly-someday-count {
  font-size: 0.75rem;
  color: var(--weekly-text-light);
}

.weekly-someday-add {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--weekly-text-light);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.weekly-someday-add:hover {
  color: var(--weekly-text);
}

/* Someday Lists Container - Horizontal Scroll */
.weekly-someday-lists-grid {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 1.5rem; 
  width: max-content; 
  min-width: 100%;
  padding-bottom: 1rem; 
  align-items: flex-start;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overflow: visible; /* Let parent container handle scrolling */
}

/* Scrollbar Styling for Someday Container */
.weekly-someday-lists-grid::-webkit-scrollbar {
    height: 8px;
}

.weekly-someday-lists-grid::-webkit-scrollbar-track {
    background: transparent;
}

.weekly-someday-lists-grid::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.dark-mode .weekly-someday-lists-grid::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
}

.weekly-someday-lists-grid::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.dark-mode .weekly-someday-lists-grid::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Remove grid column classes as we are using flex now */
.weekly-someday-lists-grid.cols-1,
.weekly-someday-lists-grid.cols-2,
.weekly-someday-lists-grid.cols-3,
.weekly-someday-lists-grid.cols-4,
.weekly-someday-lists-grid.cols-5,
.weekly-someday-lists-grid.cols-6,
.weekly-someday-lists-grid.cols-7 {
    /* No specfic grid columns, let flex handle it */
    grid-template-columns: none;
}

/* Old container class - deprecated or unused now? Keeping just in case */
.weekly-someday-lists {
  display: none; 
}

/* Ruled paper lines for someday tasks */
.weekly-someday-list {
  padding: 0;
  min-height: 200px;
  flex: 0 0 300px; /* Slightly wider lists */
  width: 300px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: visible;
  scrollbar-width: none; /* Hide scrollbar Firefox */
  -ms-overflow-style: none;  /* Hide scrollbar IE/Edge */
}

.weekly-someday-list::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari/Webkit */
}

.weekly-container.dark-mode .weekly-someday-list {
  background-image: none;
}

.task-list-slot {
  height: 38px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--weekly-border);
  box-sizing: border-box;
}

.task-list-slot.drop-target {
  background-color: rgba(0, 128, 128, 0.05); /* Subtle teal background for drop target */
}

.weekly-container.dark-mode .task-list-slot.drop-target {
  background-color: rgba(0, 128, 128, 0.15);
}

.someday-drag-handle {
    cursor: grab;
    color: #ccc;
    padding: 2px;
    margin-right: 4px;
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: background-color 0.2s, color 0.2s;
}

.someday-drag-handle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #888;
}

.dark-mode .someday-drag-handle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.someday-list-delete-btn {
    opacity: 0;
    transition: opacity 0.2s;
}

.weekly-someday-list-title-header:hover .someday-list-delete-btn {
    opacity: 1;
}

/* Placeholder styling */
.weekly-someday-list.placeholder-list {
    background-image: repeating-linear-gradient(
        transparent,
        transparent 37px,
        #e5e5e5 37px,
        #e5e5e5 38px
    );
}

.weekly-container.dark-mode .weekly-someday-list.placeholder-list {
    background-image: repeating-linear-gradient(
        transparent,
        transparent 37px,
        #4a4a4a 37px,
        #4a4a4a 38px
    );
}

.weekly-someday-list:last-child {
  border-right: none;
}

.weekly-someday-list.is-dragging {
  opacity: 0.4;
  background-color: #f0f0f0;
}

.weekly-someday-list .weekly-task-item {
  border-bottom: none; 
  min-height: 38px; 
  height: auto;
  padding: 6px 1rem;
  display: flex;
  align-items: flex-start;
  overflow: visible !important;
  position: relative;
}

.weekly-someday-list .weekly-task-item:hover {
  z-index: 50;
}

.weekly-container.dark-mode .weekly-someday-list .weekly-task-item {
  border-bottom: none;
}

.weekly-someday-list .weekly-task-text {
  word-break: break-word;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  padding: 0;
}

.weekly-someday-list-title-header {
  padding: 0 1rem;
  margin-bottom: 0;
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--weekly-border);
}

.weekly-container.dark-mode .weekly-someday-list-title-header {
  border-bottom-color: var(--weekly-border);
}

.weekly-someday-list-title-input {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--weekly-text, #222);
  background: transparent;
  border: none;
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  outline: none;
  transition: opacity 0.15s ease;
}

.weekly-someday .weekly-task-item {
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Someday task item divider lines */
.weekly-someday .weekly-task-item {
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Someday add task button */
.someday-add-task-btn {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 0;
  text-align: left;
  width: 100%;
  transition: color 0.15s ease;
}

.someday-add-task-btn:hover {
  color: #666;
}

/* Someday Tabs Bar (horizontal above grid) */
.someday-tabs-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--weekly-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.someday-tabs-bar::-webkit-scrollbar {
  display: none;
}

.someday-bar-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--weekly-text-light, #999);
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.someday-bar-icon-btn:hover {
  background: var(--weekly-hover-bg, rgba(0, 0, 0, 0.06));
  color: var(--weekly-text, #333);
}

.someday-tabs-bar-divider {
  width: 1px;
  height: 16px;
  background: var(--weekly-border, #e5e7eb);
  flex-shrink: 0;
  margin: 0 2px;
}

/* Someday Tab Buttons (horizontal) */
.someday-tab-btn-h {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--weekly-text-light, #999);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 3px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.someday-tab-btn-h:hover {
  background: var(--weekly-hover-bg, rgba(0, 0, 0, 0.06));
  color: var(--weekly-text, #333);
}

.someday-tab-btn-h.active {
  background: var(--weekly-accent, #6366f1);
  color: #fff;
}

.someday-tab-btn-h.drag-over {
  outline: 2px dashed var(--weekly-accent, #6366f1);
  outline-offset: -1px;
  background: rgba(99, 102, 241, 0.12);
}

.someday-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--weekly-hover-bg, rgba(0, 0, 0, 0.08));
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
  margin-left: 2px;
}

.someday-tab-btn-h.active .someday-tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Someday Tab Wrapper with dissolve button */
.someday-tab-wrapper-h {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.someday-tab-dissolve-h {
  position: absolute;
  right: -4px;
  top: -4px;
  background: var(--weekly-bg, #fff);
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 50%;
  cursor: pointer;
  color: var(--weekly-text-light, #999);
  padding: 1px;
  line-height: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.someday-tab-wrapper-h:hover .someday-tab-dissolve-h {
  opacity: 1;
}

.someday-tab-dissolve-h:hover {
  color: #ef4444;
  border-color: #ef4444;
}

/* Someday Tab Select (in list headers) */
.someday-tab-select {
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.someday-tab-select:hover {
  color: var(--weekly-text, #333);
}

/* Preferences Slide-in Panel */
.preferences-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: #1a1a2e;
  color: #e0e0e0;
  z-index: 2000;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

.preferences-panel.open {
  transform: translateX(0);
}

.preferences-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem;
}

/* Kanban Board */
.kanban-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.kanban-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--weekly-border, #e5e7eb);
  background: var(--weekly-bg, #fff);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.kanban-filter-search {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--weekly-bg-alt, #f3f4f6);
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 160px;
}

.kanban-filter-icon {
  color: #9ca3af;
  flex-shrink: 0;
}

.kanban-filter-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.8rem;
  width: 100%;
  color: inherit;
}

.kanban-filter-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px;
  display: flex;
  border-radius: 50%;
}
.kanban-filter-clear:hover {
  color: #374151;
  background: #e5e7eb;
}

.kanban-filter-select {
  font-size: 0.8rem;
  padding: 4px 8px;
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 6px;
  background: var(--weekly-bg-alt, #f3f4f6);
  color: inherit;
  cursor: pointer;
  max-width: 180px;
}

.kanban-filter-reset {
  background: none;
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 6px;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px 6px;
  display: flex;
  align-items: center;
}
.kanban-filter-reset:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.kanban-board {
  display: flex;
  gap: 12px;
  padding: 12px;
  overflow-x: auto;
  min-height: 300px;
  flex: 1;
}

.kanban-column {
  min-width: 250px;
  max-width: 320px;
  flex: 1;
  background: var(--weekly-bg-alt, #f8f9fa);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}

.kanban-column-drag-over {
  box-shadow: inset 0 0 0 2px var(--weekly-accent, #6366f1);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 3px solid;
  font-weight: 600;
  font-size: 0.85rem;
}

.kanban-column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-column-title {
  flex: 1;
}

.kanban-column-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--weekly-text-light, #888);
  background: rgba(0,0,0,0.06);
  border-radius: 10px;
  padding: 1px 7px;
}

.kanban-column-delete {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px;
  border-radius: 4px;
  flex-shrink: 0;
}
.kanban-column-delete:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}
.kanban-column-header:hover .kanban-column-delete {
  display: flex;
}
.kanban-column-add {
  min-width: 60px !important;
  max-width: 60px !important;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  border: 2px dashed #d1d5db;
  background: transparent !important;
}
.kanban-column-add:hover {
  opacity: 1;
}

.kanban-column-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 60px;
}

.kanban-card {
  background: var(--weekly-bg, #fff);
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.1s;
  font-size: 0.85rem;
}

.kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.kanban-card:active {
  cursor: grabbing;
  opacity: 0.8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.kanban-card-done {
  opacity: 0.5;
}

.kanban-card-done .kanban-card-title {
  text-decoration: line-through;
}

.kanban-card-header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.kanban-card-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.kanban-card-title {
  flex: 1;
  outline: none;
  line-height: 1.3;
}

.kanban-card-date {
  font-size: 0.7rem;
  color: var(--weekly-text-light, #888);
  margin-top: 4px;
  padding-left: 20px;
}

.kanban-card-time {
  font-weight: 600;
  color: var(--weekly-text, #555);
}

.kanban-card-project {
  font-size: 0.7rem;
  margin-top: 2px;
  padding-left: 20px;
}

.kanban-card-list {
  font-size: 0.65rem;
  margin-top: 2px;
  padding-left: 20px;
  color: #6b7280;
  font-style: italic;
}

/* Kanban stage color indicator on weekly tasks */
.kanban-card-subtask-toggle {
  margin-top: 4px;
}
.kanban-card-subtask-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 0;
  color: var(--weekly-text-muted, #9ca3af);
  font-size: 0.7rem;
  font-weight: 600;
  width: 100%;
}
.kanban-card-subtask-btn:hover {
  color: var(--weekly-text, #666);
}
.kanban-card-subtask-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--weekly-border, #e5e7eb);
  position: relative;
  overflow: hidden;
  max-width: 60px;
}
.kanban-card-subtask-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.kanban-card-subtask-count {
  font-size: 0.7rem;
  opacity: 0.8;
}
.kanban-card-subtask-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 2px 2px;
}
.kanban-card-subtask-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--weekly-text, #333);
  padding: 1px 0;
}
.kanban-card-subtask-item input[type="checkbox"] {
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.kanban-card-subtask-item.completed {
  opacity: 0.5;
}
.kanban-card-subtask-done {
  text-decoration: line-through;
}

.kanban-stage-indicator {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
  margin-right: 4px;
}

@media (max-width: 768px) {
  .kanban-board {
    gap: 8px;
    padding: 8px;
  }

  .kanban-column {
    min-width: 200px;
    max-width: none;
  }
}

/* Kanban Detail Modal */
.kanban-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: kanbanFadeIn 0.15s ease;
}
@keyframes kanbanFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.kanban-detail-modal {
  background: var(--weekly-bg, #fff);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: kanbanSlideUp 0.2s ease;
  overflow: hidden;
}
@keyframes kanbanSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.kanban-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--weekly-border, #e5e7eb);
}
.kanban-detail-title-input {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--weekly-text, #111);
  outline: none;
  font-family: inherit;
}
.kanban-detail-title-input:focus {
  border-bottom: 2px solid var(--weekly-accent, #6366f1);
}
.kanban-detail-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--weekly-text-muted, #9ca3af);
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.kanban-detail-close:hover {
  background: var(--weekly-hover, rgba(0,0,0,0.05));
  color: var(--weekly-text, #111);
}
.kanban-detail-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.kanban-detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.kanban-detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kanban-detail-field label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--weekly-text-muted, #9ca3af);
  display: flex;
  align-items: center;
  gap: 4px;
}
.kanban-detail-select,
.kanban-detail-date {
  padding: 6px 8px;
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 6px;
  background: var(--weekly-bg, #fff);
  color: var(--weekly-text, #111);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}
.kanban-detail-select:focus,
.kanban-detail-date:focus {
  outline: none;
  border-color: var(--weekly-accent, #6366f1);
}
.kanban-detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kanban-detail-section > label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--weekly-text-muted, #9ca3af);
  display: flex;
  align-items: center;
  gap: 4px;
}
.kanban-detail-notes {
  padding: 10px 12px;
  border: 1px solid var(--weekly-border, #e5e7eb);
  border-radius: 8px;
  background: var(--weekly-bg, #fff);
  color: var(--weekly-text, #111);
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.kanban-detail-notes:focus {
  outline: none;
  border-color: var(--weekly-accent, #6366f1);
}
.kanban-detail-subtasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kanban-detail-subtask {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.kanban-detail-subtask input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}
.kanban-detail-subtask-title {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--weekly-text, #111);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  padding: 2px 4px;
  border-radius: 4px;
}
.kanban-detail-subtask-title:focus {
  background: var(--weekly-hover, rgba(0,0,0,0.03));
}
.kanban-detail-subtask-title.completed {
  text-decoration: line-through;
  opacity: 0.5;
}
.kanban-detail-subtask-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--weekly-text-muted, #d1d5db);
  padding: 2px;
  border-radius: 4px;
  display: flex;
  opacity: 0;
  transition: opacity 0.1s;
}
.kanban-detail-subtask:hover .kanban-detail-subtask-delete {
  opacity: 1;
}
.kanban-detail-subtask-delete:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.08);
}
.kanban-detail-subtask-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--weekly-text-muted, #9ca3af);
}
.kanban-detail-subtask-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--weekly-text, #111);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  padding: 2px 4px;
}
.kanban-detail-subtask-input::placeholder {
  color: var(--weekly-text-muted, #d1d5db);
}
.kanban-detail-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--weekly-border, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-detail-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #9ca3af;
  background: none;
}
.kanban-detail-delete:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.08);
}
.kanban-detail-footer-right {
  display: flex;
  gap: 8px;
}
.kanban-detail-btn {
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid var(--weekly-border, #e5e7eb);
}
.kanban-detail-btn-cancel {
  background: transparent;
  color: var(--weekly-text-muted, #6b7280);
}
.kanban-detail-btn-cancel:hover {
  background: var(--weekly-hover, rgba(0,0,0,0.04));
}
.kanban-detail-btn-ok {
  background: var(--weekly-accent, #6366f1);
  color: #fff;
  border-color: var(--weekly-accent, #6366f1);
}
.kanban-detail-btn-ok:hover {
  opacity: 0.9;
}

@media (max-width: 600px) {
  .kanban-detail-modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }
  .kanban-detail-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .kanban-detail-meta {
    grid-template-columns: 1fr;
  }
}

.preferences-overlay {
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: rgba(0,0,0,0.15);
}

.pref-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.pref-label {
  font-size: 0.9rem;
  color: #ccc;
}

.pref-options {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pref-option-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #aaa;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pref-option-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.pref-option-btn.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

.pref-toggle {
  background: none;
  border: none;
  color: #666;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.15s ease;
}

.pref-toggle.active {
  color: #4dd0e1;
}

.pref-full-settings-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #ccc;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s ease;
}

.pref-full-settings-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.preferences-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.2rem;
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s ease;
}

.preferences-close-btn:hover {
  color: #fff;
}

/* Weekly Footer */
.weekly-footer {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: var(--weekly-bg);
  border-top: 1px solid var(--weekly-border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weekly-view-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.weekly-view-btn {
  background: none;
  border: none;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  color: var(--weekly-text-light);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.weekly-view-btn:hover {
  background: #f5f5f5;
  color: var(--weekly-text);
}

.weekly-view-btn.active {
  color: var(--weekly-text);
  font-weight: 600;
}

.weekly-footer-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.weekly-sync-status {
  font-size: 0.75rem;
  color: var(--weekly-text-light);
}

.weekly-dark-toggle {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--weekly-text-light);
}

/* Calendar Events in Day Column */
.weekly-calendar-event {
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--weekly-teal);
  background: #f8fafa;
  margin: 0.25rem 0.5rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.875rem;
}

.weekly-calendar-event-time {
  font-size: 0.75rem;
  color: var(--weekly-teal);
  font-weight: 500;
}

.weekly-calendar-event-title {
  color: var(--weekly-text);
  font-family: var(--weekly-font);
}

/* Drag and Drop States */
.weekly-task-item.dragging {
  opacity: 0.5;
}

.weekly-day-column.drop-target {
  background: #f0fafa;
}

/* Settings Modal */
.weekly-settings-overlay {
  position: fixed;
  inset: 0;
  background: transparent !important; /* Changed from rgba(0, 0, 0, 0.4) for real-time preview */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.weekly-settings-modal {
  background: var(--weekly-bg);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.weekly-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--weekly-border);
}

.weekly-settings-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.weekly-settings-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--weekly-text-light);
}

.weekly-settings-content {
  padding: 1.5rem;
}

/* Dark Mode */
.weekly-container.dark-mode {
  --weekly-bg: #323232;
  --weekly-text: #f0f0f0;
  --weekly-text-light: #aaa;
  --weekly-border: #4a4a4a;
  --weekly-completed: #666666;
  
  /* Settings Sidebar Theme (Dark) */
  --weekly-settings-bg: #111111;
  --weekly-settings-item-bg: #1a1a1a;
  --weekly-settings-label: #aaaaaa;
  --weekly-settings-title: #ffffff;
  --weekly-settings-input-bg: #222222;
  --weekly-settings-input-border: #333333;
  --weekly-settings-text: #ffffff;
  --weekly-settings-toggle-bg: #222222;
  --weekly-settings-toggle-active-bg: #333333;
  --weekly-header-brightness: 1.5;
  --weekly-goal-brightness: 1.5;
  --weekly-settings-toggle-text: #888888;
  --weekly-settings-toggle-active-text: #ffffff;
}

/* Ensure inputs have explicit color for mobile Safari */
.weekly-container input,
.weekly-container textarea {
  color: var(--weekly-text, #333333);
  -webkit-text-fill-color: var(--weekly-text, #333333);
}

.weekly-container.dark-mode input,
.weekly-container.dark-mode textarea {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.weekly-container.dark-mode .weekly-task-input input {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.weekly-container.dark-mode .weekly-task-input input::placeholder {
  color: #888888;
}

.weekly-container.dark-mode .weekly-task-item:hover {
  background-color: transparent;
}

.weekly-container.dark-mode .weekly-calendar-event {
  background: #2a3a3a;
}

/* Bb: Remove someday list backgrounds in dark mode */
.weekly-container.dark-mode .weekly-someday-list {
  background-image: none;
  background-color: transparent;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* === Tablet (≤ 1024px): 5-day view === */
@media (max-width: 1024px) {
}

/* === Phone landscape / small tablet (≤ 768px): 3-day view === */
@media (max-width: 768px) {

  .weekly-someday-lists {
    grid-template-columns: 1fr;
  }

  /* Compact time column */
  .time-column {
    width: 40px;
  }

  .time-slot-label {
    font-size: 0.55rem;
    padding: 0 0.25rem;
  }

  /* Compact day headers */
  .weekly-day-header {
    padding: 0.5rem 0.25rem;
  }

  .weekly-day-name {
    font-size: 0.8rem;
  }

  .weekly-day-date {
    font-size: 0.7rem;
  }

  /* Smaller text in time slots */
  .time-slot-task {
    font-size: 0.7rem;
  }

  .time-slot-event .event-title {
    font-size: 0.75rem;
  }

  .time-slot-event .event-time-row {
    font-size: 0.65rem;
  }

  /* Touch-friendly: taller minimum slot height */
  .time-slot {
    min-height: 28px;
  }

  /* Hide side nav on mobile (swipe navigation is used instead) */
  .side-nav {
    display: none;
  }

  /* Settings sidebar: full width and single-scroll on mobile */
  .weekly-settings-sidebar {
    width: 100% !important;
    max-width: 100vw;
    overflow-y: auto !important;
    display: block !important;
  }
  .weekly-settings-sidebar .weekly-settings-content {
    overflow-y: visible !important;
    flex: none !important;
  }

  /* Ensure grid respects viewDays columns on mobile landscape */
  .time-grid-wrapper {
    overflow: visible;
    min-width: 0;
  }
  .time-grid-wrapper .weekly-days-grid {
    overflow: visible;
    min-width: 0;
  }
}

/* === Phone portrait (≤ 480px): 1-day view === */
@media (max-width: 480px) {

  /* Narrower time column on phone */
  .time-column {
    width: 36px;
  }

  .time-slot-label {
    font-size: 0.5rem;
    padding: 0 2px;
  }

  /* Full-width header on phone */
  .weekly-header {
    padding: 0.5rem 0.75rem;
  }

  .weekly-day-header {
    padding: 0.5rem;
  }

  /* Larger tap targets */
  .time-slot {
    min-height: 32px;
    padding: 0px 4px;
  }

  .time-slot-task {
    font-size: 0.75rem;
    padding: 3px 0;
  }

  /* Settings panel full-width on phone (inherits mobile rules from 768px) */

  .preferences-panel {
    width: 100%;
  }
}

/* ============================================
   TIME GRID STYLES
   ============================================ */

/* .time-grid-controls removed, using Tailwind classes */

.time-grid-controls input[type="checkbox"] {
  accent-color: var(--weekly-teal);
}

.cell-duration-select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--weekly-border);
  border-radius: 4px;
  background: var(--weekly-bg);
  color: var(--weekly-text);
  font-size: 0.875rem;
  cursor: pointer;
}

.time-grid-wrapper {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* Side Navigation Arrows (hover overlays) */
.side-nav {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  gap: 2px;
  z-index: 30;
  pointer-events: none; /* Let clicks pass through to grid except buttons */
}

.side-nav-btn {
  pointer-events: auto;
}

.side-nav .side-nav-btn {
  opacity: 0;
  transition: opacity 0.2s, background 0.15s, color 0.15s;
}

.side-nav:hover .side-nav-btn {
  opacity: 1;
}

.side-nav-left {
  left: 0;
  width: 100%;
}

.side-nav-right {
  right: 0;
}

.side-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--weekly-text-light, #999);
  cursor: pointer;
  border-radius: 6px;
}

.side-nav-btn:hover {
  background: var(--weekly-bg); /* Use background over hover to hide header text */
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  color: var(--weekly-text, #333);
}

/* Time Column (Hours) */
.time-column {
  width: 55px; /* Slightly wider for labels */
  flex-shrink: 0;
  border-right: 1px solid var(--weekly-border);
  background: var(--weekly-bg);
  display: flex;
  flex-direction: column;
  /* Flush to left */
  margin-left: -1px; 
}

.time-column-header {
  padding: 1rem 1rem 0.75rem; /* Match weekly-day-header padding */
  min-height: 50px; /* Match weekly-day-header min-height */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.time-column-slots {
  flex: 1;
  overflow-y: visible; /* Unify with parent scroll */
  position: relative;
  padding-top: 0; /* Flush with header */
}


.time-slot-label {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0 0.5rem;
  font-size: 0.65rem;
  color: var(--weekly-text-light);
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  transform: translateY(-0.4em);
}

.time-slot-label.hour-start {
  font-weight: 500;
  color: var(--weekly-text);
}

.time-slot-label.sub-hour {
  color: var(--weekly-text-light);
  font-size: 0.55rem;
}

.time-slot-label span {
  transform: translateY(-50%); /* Centers the label on the grid line */
  background: var(--weekly-bg);
  padding: 0 4px;
  z-index: 1;
  display: inline-block;
  line-height: 1;
}

.time-slot-label .sub-hour-label {
  transform: translateY(-50%);
  background: var(--weekly-bg);
  padding: 0 2px;
  z-index: 1;
  opacity: 0.5;
  font-size: 0.55rem;
}

/* Time Slots Container */
.time-slots-container {
  flex: 1;
  overflow: visible; /* Changed from auto to unify scroll */
  overflow-x: visible;
  padding-top: 0; /* Flush with header */
}

.time-slot {
  position: relative;
  /* Transition for theme switching */
  transition: background-color 0.3s ease, color 0.3s ease;
  padding: 0px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: visible;
  cursor: text;
  background: transparent;
}

.time-slot.hour-start {
  /* Weekly-style: subtle dotted line at hour boundaries */
  border-top: 1px dotted var(--weekly-border);
}

.time-slot:hover {
  /* Very subtle hover - almost invisible */
  background: transparent;
}

.time-slot.active {
  /* Minimal active state */
  background: transparent;
}

.time-slot.drop-target:hover {
  /* Subtle drop indicator */
  background: rgba(0, 154, 154, 0.04);
}

/* Slot Input Form */
.slot-input-form {
  width: 100%;
}

.slot-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-family: inherit;
  padding: 2px 0;
  outline: none;
  caret-color: var(--weekly-teal);
}

.time-slot-task {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 2px 0;
  background: transparent;
  font-family: var(--weekly-time-task-font, var(--weekly-task-font, var(--weekly-font)));
  font-size: var(--weekly-time-task-size, var(--weekly-task-size, 0.9rem));
  font-weight: var(--weekly-time-task-weight, var(--weekly-task-weight, 400));
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: clip;
  transition: color 0.15s ease;
  position: relative;
  z-index: 5;
  /* Weekly-style: clean text, no boxes */
  color: var(--weekly-text);
  line-height: initial;
}

.time-slot-task:hover {
  color: var(--weekly-teal);
}

.time-slot-task:active {
  cursor: grabbing;
}

.time-slot-task.dragging {
  opacity: 0.4;
}

.time-slot-task.completed {
  /* Weekly-style strikethrough */
  text-decoration: line-through;
  color: var(--weekly-completed);
}

/* Calendar Events in Time Slots */
.time-slot-event {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 4px 8px;
  background: rgba(0, 154, 154, 0.1);
  border-left: 3px solid var(--weekly-teal);
  font-size: 0.85rem;
  color: var(--weekly-teal);
  border-radius: 0 4px 4px 0;
  margin: 1px 0;
  overflow: hidden;
  left: 0;
  right: 0;
  box-sizing: border-box;
}

.time-slot-event .event-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}

.time-slot-event .event-indicator {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.event-title {
  font-weight: var(--weekly-event-weight, 600);
  font-size: var(--weekly-event-size, 0.85rem);
  font-family: var(--weekly-event-font, var(--weekly-font));
}

.time-slot-event .event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: var(--weekly-event-weight, 500);
  font-family: var(--weekly-event-font, var(--weekly-font));
  font-size: var(--weekly-event-size, 0.85rem);
}

.time-slot-event .event-time-row {
  font-size: 0.75rem;
  opacity: 0.9;
  font-family: var(--weekly-event-font, var(--weekly-font));
}

.time-slot-event:hover {
  background: rgba(0, 154, 154, 0.15);
}

/* Make day columns scrollable when using time grid */
.time-grid-wrapper .weekly-days-grid {
  flex: 1;
  overflow-y: auto; /* Unified scroll container */
  overflow-x: hidden;
}

.time-grid-wrapper .weekly-day-column {
  max-height: none;
  min-height: auto;
  display: flex;
  flex-direction: column;
}

.time-grid-wrapper .weekly-day-header {
  flex-shrink: 0;
}

.time-grid-wrapper .time-slots-container {
  overflow: visible;
}

/* All-Day Events Section */
.all-day-events-section {
  background: var(--weekly-bg);
  border-top: 1px solid var(--weekly-border);
  padding: 2px 0;
  position: relative;
  flex-shrink: 0;
}

/* Resize handle for draggable section borders */
.resize-handle {
  height: 7px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  border-top: 1px solid var(--weekly-border, #e5e7eb);
  border-bottom: 1px solid var(--weekly-border, #e5e7eb);
}
.resize-handle:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--weekly-accent, #3b82f6);
}
.resize-handle:active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--weekly-accent, #3b82f6);
}
.resize-handle-bar {
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: var(--weekly-border, #e5e7eb);
  opacity: 0.6;
  transition: background 0.15s, opacity 0.15s;
}
.resize-handle:hover .resize-handle-bar,
.resize-handle:active .resize-handle-bar {
  background: var(--weekly-accent, #3b82f6);
  opacity: 0.5;
}

.all-day-events-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 1rem;
  margin-bottom: 0;
}

.all-day-events-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--weekly-text-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.all-day-events-count {
  background: var(--weekly-teal);
  color: white;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
}

.all-day-events-grid {
  display: grid;
  /* margin-left is set dynamically via inline style based on showTimeGrid */
  padding: 0 0;
}

.all-day-events-grid.cols-1 { grid-template-columns: repeat(1, 1fr); }
.all-day-events-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.all-day-events-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.all-day-events-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.all-day-events-grid.cols-7 { grid-template-columns: repeat(7, 1fr); }

.all-day-events-column {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.25rem;
  min-height: 28px;
  border-right: 1px solid var(--weekly-border);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.all-day-events-column::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.all-day-events-column:last-child {
  border-right: none;
}

.all-day-event {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 154, 154, 0.1);
  border-left: 3px solid var(--weekly-teal);
  border-radius: 0 4px 4px 0;
  font-size: 0.75rem;
  color: var(--weekly-text);
  cursor: default;
}

.all-day-event .event-indicator {
  font-size: 0.7rem;
}

.all-day-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 24px); /* Account for icon */
  flex: 1;
}

.all-day-empty {
  min-height: 28px;
}

/* "Now" Line - Current time indicator */
.now-line {
  position: absolute;
  left: 0;
  right: 40px;
  height: 2px;
  background: #d50000;
  z-index: 10;
  pointer-events: none;
}

.now-line::before {
  content: attr(data-time);
  position: absolute;
  right: -40px;
  padding-right: 8px; 
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  color: #d50000;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  z-index: 12;
}

.now-line::after {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  background: #d50000;
  border-radius: 50%;
  z-index: 12;
}

/* Drop Preview for Drag-n-Drop */
.drop-preview {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 30px;
  background: rgba(0, 154, 154, 0.15);
  border: 2px dashed var(--weekly-teal);
  border-radius: 4px;
  pointer-events: none;
  z-index: 20;
  transition: top 0.1s ease;
}

/* Task being dragged - source placeholder */
.weekly-task-item.drag-source,
.time-slot-task.drag-source {
  opacity: 0.4;
  background: rgba(0, 154, 154, 0.05);
  border: 1px dashed var(--weekly-teal);
}

/* Calendar connect button */
.calendar-connect-btn {
  flex: 1;
  padding: 1rem;
  border: 1px solid var(--weekly-border);
  border-radius: 8px;
  background: var(--weekly-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.calendar-connect-btn:hover {
  border-color: var(--weekly-teal);
  background: rgba(0, 154, 154, 0.05);
}

.calendar-connect-btn span {
  font-size: 1.25rem;
}

/* Draggable task items */
.weekly-task-item {
  cursor: grab;
}

.weekly-task-item:active {
  cursor: grabbing;
}

.weekly-task-item.dragging {
  opacity: 0.4;
  background: rgba(0, 154, 154, 0.1);
}

/* Dark mode additions for time grid */
.weekly-container.dark-mode .cell-duration-select {
  background: #2a2a2a;
  border-color: var(--weekly-border);
  color: var(--weekly-text);
}

.weekly-container.dark-mode .time-slot {
  border-top: 1px dotted transparent;
}

.weekly-container.dark-mode .time-slot.hour-start {
  border-top-color: var(--weekly-border);
}

.weekly-container.dark-mode .time-slot.drop-target:hover {
  background: rgba(0, 154, 154, 0.15);
}

.weekly-container.dark-mode .time-slot-task {
  background: transparent;
}

.weekly-container.dark-mode .calendar-connect-btn {
  background: #2a2a2a;
}

.weekly-container.dark-mode .calendar-connect-btn:hover {
  background: rgba(0, 154, 154, 0.15);
}

/* ============================================
   LIST VIEW STYLES
   ============================================ */

.weekly-container.list-view .weekly-day-column {
  border-left-width: 0px;
}

.weekly-container.list-view .time-slot.hour-start {
  margin-left: 20px;
  border-right-width: 20px;
  padding-left: 0px;
  padding-right: 0px;
}

.weekly-container.list-view .time-column {
  width: 40px;
}

/* Event Protection Overlay - matches exact event position and height */
.event-protection-overlay {
  background: transparent;
  border-radius: 4px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 4px;
}

/* Clickable lock/unlock button on calendar events */
.event-unlock-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.event-unlock-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* All-day chevron positioning */
.all-day-chevron {
  position: absolute;
  top: 0.25rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: #666;
  padding: 0.25rem;
  transition: color 0.15s ease;
}

.all-day-chevron:hover {
  color: var(--weekly-text);
}

/* ============================================
   AUTH PAGES STYLES (Weekly-style)
   ============================================ */

.weekly-auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
  padding: 2rem;
}

.weekly-auth-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
  padding: 3rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.weekly-auth-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.weekly-auth-tagline {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.weekly-auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.weekly-auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.weekly-auth-field {
  width: 100%;
}

.weekly-auth-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.weekly-auth-input:focus {
  border-color: var(--weekly-teal, #009a9a);
  box-shadow: 0 0 0 3px rgba(0, 154, 154, 0.1);
}

.weekly-auth-input::placeholder {
  color: #999;
}

.weekly-auth-button {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.weekly-auth-button.primary {
  background: var(--weekly-teal, #009a9a);
  color: white;
  border: none;
}

.weekly-auth-button.primary:hover {
  background: #008888;
}

.weekly-auth-button.primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.weekly-auth-button.google {
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
}

.weekly-auth-button.google:hover {
  background: #f9f9f9;
  border-color: #ccc;
}

.weekly-auth-button.google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.weekly-auth-button .google-icon {
  flex-shrink: 0;
}

.weekly-auth-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
}

.weekly-auth-divider::before,
.weekly-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.weekly-auth-divider span {
  padding: 0 1rem;
  color: #999;
  font-size: 0.875rem;
}

.weekly-auth-links {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.weekly-auth-link {
  color: var(--weekly-teal, #009a9a);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s ease;
}

.weekly-auth-link:hover {
  color: #008888;
  text-decoration: underline;
}

.weekly-auth-link-divider {
  color: #ccc;
}

.weekly-auth-text {
  color: #666;
  font-size: 0.875rem;
}

.weekly-auth-footer {
  margin-top: 2rem;
  color: #999;
  font-size: 0.8rem;
  font-style: italic;
}

/* --- FIXES & NEW FEATURES --- */



/* Consolidate Task Hover Actions - Removed redundant entries */

.task-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.task-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #333;
}

.task-action-btn.delete:hover {
  color: #d32f2f;
  background-color: rgba(211, 47, 47, 0.1);
}

/* Roll Menu Dropdown */
.roll-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  min-width: 120px;
  overflow: hidden;
}

.roll-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  text-align: left;
  font-size: 12px;
  color: var(--weekly-text);
  cursor: pointer;
  transition: background 0.2s;
}

.roll-menu button:hover {
  background: var(--weekly-teal);
  color: white;
}

/* Notes Modal */
.weekly-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.weekly-modal-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.weekly-modal-content h3 {
  margin: 0 0 16px 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.weekly-notes-editor {
  width: 100%;
  height: 200px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}

.weekly-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.weekly-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.weekly-btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.weekly-btn-secondary:hover {
  background: #e0e0e0;
}

.weekly-btn-primary {
  background: #000;
  color: #fff;
}

.weekly-btn-primary:hover {
  background: #333;
}

/* --- SLIDE ANIMATION (Day/Week Navigation) --- */
/* Class-based animation that works on ALL browsers (no View Transitions API needed) */

@keyframes navSlideInFromRight {
  from { transform: translateX(30%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes navSlideInFromLeft {
  from { transform: translateX(-30%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.slide-animate-next {
  animation: navSlideInFromRight 0.3s cubic-bezier(0.25, 1, 0.5, 1) both;
}
.slide-animate-prev {
  animation: navSlideInFromLeft 0.3s cubic-bezier(0.25, 1, 0.5, 1) both;
}

/* Week navigation: slightly longer slide with more offset */
.slide-animate-week-next {
  animation: navSlideInFromRight 0.45s cubic-bezier(0.25, 1, 0.5, 1) both;
}
.slide-animate-week-prev {
  animation: navSlideInFromLeft 0.45s cubic-bezier(0.25, 1, 0.5, 1) both;
}

/* Smooth View Transitions */
::view-transition-group(root) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
  /* Default cross-fade is fine for non-navigation transitions */
}

/* ============================================
   SETTINGS SIDEBAR STYLES
   ============================================ */
.weekly-settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 2000;
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  display: block; /* Overriding possible flex from parent if any */
}

.weekly-settings-overlay.show {
  opacity: 1;
  visibility: visible;
}

.weekly-settings-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  background: var(--weekly-bg, white);
  color: var(--weekly-text, #000000);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2001;
  overflow: hidden;
  border-left: 1px solid #eee;
}

.weekly-settings-sidebar.open {
  transform: translateX(0);
}

.dark-mode .weekly-settings-sidebar {
  background: var(--weekly-bg, #111);
  border-left: 1px solid #333;
  color: var(--weekly-text, #f0f0f0);
}

.weekly-settings-sidebar .weekly-settings-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

/* Notes Sidebar */
.weekly-notes-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  max-width: 90vw;
  height: 100vh;
  background: white;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2005;
  overflow: hidden;
  border-left: 1px solid #eee;
}

.weekly-notes-sidebar.open {
  transform: translateX(0);
}

.dark-mode .weekly-notes-sidebar {
  background: #111;
  border-left: 1px solid #333;
  color: white;
}

.weekly-notes-sidebar-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.dark-mode .weekly-notes-sidebar-header {
  border-bottom-color: #333;
}

.weekly-notes-sidebar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.weekly-notes-sidebar-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.2s;
}

.weekly-notes-sidebar-close:hover {
  background: #f5f5f5;
  color: #333;
}

.dark-mode .weekly-notes-sidebar-close:hover {
  background: #222;
  color: white;
}

.weekly-notes-sidebar-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.weekly-notes-sidebar .weekly-notes-editor {
  flex: 1;
  min-height: 300px;
  border: 1px solid #eee;
  padding: 16px;
  font-size: 1rem;
  line-height: 1.6;
  border-radius: 8px;
  background: #fafafa;
  margin-top: 16px;
}

.dark-mode .weekly-notes-sidebar .weekly-notes-editor {
  background: #1a1a1a;
  border-color: #333;
  color: #eee;
}

.weekly-notes-sidebar .notes-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: #f5f5f5;
  border-radius: 6px;
  margin-bottom: 4px;
}

.dark-mode .weekly-notes-sidebar .notes-toolbar {
  background: #222;
}
.settings-tab-btn:hover {
  opacity: 0.8 !important;
  background: rgba(0, 0, 0, 0.04) !important;
  border-radius: 6px 6px 0 0;
}
.dark-mode .settings-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.dark-mode .weekly-settings-sidebar .weekly-settings-header {
  border-bottom-color: #333;
}

.weekly-settings-sidebar .weekly-settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.weekly-settings-sidebar .weekly-settings-footer {
  padding: 20px 24px;
  border-top: 1px solid #eee;
  background: #f9f9f9;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.dark-mode .weekly-settings-sidebar .weekly-settings-footer {
  background: #1a1a1a;
  border-top-color: #333;
}

.toggle-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.settings-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

/* Ensure settings sidebar labels are readable */
.weekly-settings-sidebar label {
  color: var(--weekly-text, #000000);
}
.dark-mode .weekly-settings-sidebar label {
  color: var(--weekly-text, #f0f0f0);
}

/* Form Elements in Settings */
.weekly-input,
.weekly-settings-sidebar select,
.weekly-settings-sidebar input[type="text"],
.weekly-settings-sidebar input[type="number"] {
  background: var(--weekly-settings-input-bg) !important;
  color: var(--weekly-settings-text) !important;
  border: 1px solid var(--weekly-settings-input-border) !important;
  border-radius: 4px;
  padding: 8px;
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
}

.weekly-input:focus,
.weekly-settings-sidebar select:focus,
.weekly-settings-sidebar input:focus {
  outline: 2px solid var(--weekly-teal);
  outline-offset: -1px;
}

.event-title {
  font-family: var(--weekly-event-font);
  font-weight: var(--weekly-event-weight);
  font-size: var(--weekly-event-size);
  line-height: 1.2; 
}

.event-time-row {
  font-family: var(--weekly-event-font);
  font-size: 0.7rem;
  opacity: 0.9;
}

/* Header Icons */
.weekly-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e0e0e0;
  background-color: white;
  color: #555;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.weekly-btn-icon:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  color: #111;
}

.weekly-btn-icon.active {
  background-color: #e5e7eb;
  border-color: #9ca3af;
  color: #000;
}

.dark-mode .weekly-btn-icon {
  background-color: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.dark-mode .weekly-btn-icon:hover {
  background-color: #374151;
  color: #e5e7eb;
}

.dark-mode .weekly-btn-icon.active {
  background-color: #4b5563;
  color: #fff;
}

/* Header Hover Reveal */
.group:hover .transition-opacity {
    opacity: 1;
}

.group .transition-opacity {
    opacity: 0;
}

/* Responsive header sections */
.header-desktop-only {
    display: flex;
}
.header-tablet-only {
    display: none;
}

@media (max-width: 1024px) {
    .header-desktop-only {
        display: none !important;
    }
    .header-tablet-only {
        display: block !important;
    }
    /* Make controls visible on tablet (no hover on touch devices) */
    .weekly-header-controls {
        opacity: 1 !important;
        transition: none !important;
    }
}

/* Header overflow menu (tablet) */
.header-overflow-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 200px;
    padding: 6px;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: menuFadeIn 0.15s ease;
}

.dark-mode .header-overflow-menu {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.header-overflow-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s;
}

.header-overflow-menu button:hover {
    background: #f3f4f6;
}

.header-overflow-menu button:disabled {
    opacity: 0.35;
    cursor: default;
}

.dark-mode .header-overflow-menu button {
    color: #d1d5db;
}

.dark-mode .header-overflow-menu button:hover {
    background: #374151;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* List View (formerly Grid/App View - no vertical lines) */
.list-view.time-grid-off .weekly-day-column {
    border-right: none !important;
}

/* Calendar View (Google Calendar Style) */
.calendar-view.time-grid-on .weekly-day-column {
    border-right: 1px solid #dadce0;
    margin: 4px !important;
}
.calendar-view .time-column {
    border-right: 1px solid #dadce0;
}
.calendar-view .time-column-header {
    border-bottom: 1px solid #dadce0;
}
.calendar-view .time-slot {
    border-bottom: none;
}
.calendar-view .time-slot.hour-start {
    border-top: 1px solid #dadce0;
    margin-top: 0px;
}
.calendar-view .time-slot-label {
    color: #70757a;
}
.calendar-view .time-slot-label.hour-start {
    color: #70757a;
    font-weight: 500;
}
.calendar-view .time-slot-label.sub-hour {
    color: #9aa0a6;
    font-size: 0.55rem;
}
.calendar-view .weekly-day-header {
    border-bottom: 1px solid #dadce0;
    font-weight: 500;
}
.calendar-view .time-slot-event {
    border-radius: 4px;
    border-left: none;
    font-size: 0.8rem;
}
.dark-mode .calendar-view.time-grid-on .weekly-day-column {
    border-right: 1px solid #333;
}
.dark-mode .calendar-view .time-column {
    border-right: 1px solid #333;
}
.dark-mode .calendar-view .time-slot {
    border-bottom: none;
}
.dark-mode .calendar-view .time-slot.hour-start {
    border-top: 1px solid #333;
}
.dark-mode .calendar-view .time-slot-label {
    color: #9aa0a6;
}
.dark-mode .calendar-view .time-slot-label.hour-start {
    color: #bbb;
    font-weight: 500;
}
.dark-mode .calendar-view .weekly-day-header {
    border-bottom: 1px solid #333;
}

/* Simple View (TeuxDeux Style) */
.simple-view .weekly-day-column {
    border-left: 0px !important;
    border-right: none !important;
    margin: 0 10px 0 10px !important;
    overflow-x: hidden !important;
    word-wrap: break-word;
}
.simple-view .time-column {
    border-right: 0px !important;
}
.simple-view .time-slot {
    border-bottom: none;
}
.simple-view .time-slot.hour-start {
    border-top: 1px solid #dadce0;
}
.simple-view .time-slot-event {
    left: 0 !important;
    right: 0 !important;
}
.simple-view .weekly-day-header {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    padding: 16px 8px 10px;
    border-bottom: 1px solid #ddd;
}
.dark-mode .simple-view .weekly-day-header {
    border-bottom: 1px solid #444;
}
.simple-view .task-item {
    border: none !important;
    border-bottom: 1px solid #eee !important;
    border-radius: 0 !important;
    padding: 10px 8px !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 0.9rem;
}
.dark-mode .simple-view .task-item {
    border-bottom: 1px solid #333 !important;
}
.simple-view .task-item:hover {
    background: rgba(0,0,0,0.02) !important;
}
.dark-mode .simple-view .task-item:hover {
    background: rgba(255,255,255,0.03) !important;
}

.kanban-project-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  border: 2px solid transparent;
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.kanban-project-chip-drag-over {
  border-color: var(--weekly-accent, #6366f1);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}



/* Scrollbar Hiding for All-Day Events */
.all-day-events-column {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.all-day-events-column::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Responsive Design - Header & Layout */
@media (max-width: 768px) {
    /* Mobile header: stack and compact */
    .weekly-header {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 0.75rem;
        gap: 6px;
    }

    .weekly-header > div {
        flex-shrink: 0;
    }

    /* CRITICAL: Make all header sections visible on mobile (no hover on touch devices) */
    .weekly-header-controls {
        opacity: 1 !important;
        transition: none !important;
    }

    /* Fix overlap on mobile by removing absolute positioning */
    .weekly-header .absolute {
        position: static !important;
        transform: none !important;
        left: auto !important;
        margin: 0;
    }

    .weekly-btn-icon {
        width: 32px;
        height: 32px;
    }

    /* Stack days vertically in list view on mobile */
    .list-view .weekly-days-grid {
        grid-template-columns: 1fr !important;
        overflow-y: auto;
    }

    .weekly-day-column {
        min-height: auto;
    }

    /* D) Mobile: sticky day header at top so user always knows which day */
    .weekly-days-grid {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .weekly-day-column {
        overflow-y: visible;
        overflow-x: visible;
        max-height: none;
    }

    .weekly-day-header {
        position: sticky;
        top: calc(48px + env(safe-area-inset-top, 0px));
        z-index: 40;
        background: var(--weekly-bg, white);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }
    /* In time-grid mode, the scroll container is time-grid-wrapper, so top=0 */
    .time-grid-on .weekly-day-header {
        top: 0 !important;
    }
}

@media (max-width: 480px) {
    /* Phone: make header even more compact */
    .weekly-header {
        padding: 0.4rem 0.5rem;
        gap: 4px;
    }

    .weekly-btn-icon {
        width: 28px;
        height: 28px;
    }

    .weekly-logo {
        font-size: 1rem;
    }

    .dark-mode .weekly-day-header {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
}



/* Weekly App Spinner */
@keyframes weekly-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.weekly-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: weekly-spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

.weekly-spinner-white {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
}


.dark-mode .weekly-spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #60a5fa;
}


/* ============================================
   TOUCH DEVICE OVERRIDES (@media pointer: coarse)
   ============================================ */
@media (pointer: coarse) {
  /* Prevent iOS tap highlight */
  * { -webkit-tap-highlight-color: transparent; }

  /* Disable text selection on interactive task items */
  .weekly-task-item,
  .time-slot-task {
    -webkit-user-select: none;
    user-select: none;
  }

  /* --- Task Actions: tap-to-reveal instead of hover --- */
  /* Disable hover reveal on touch devices */
  .weekly-task-item:hover .task-actions,
  .time-slot-task:hover .task-actions {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }
  /* Show via .touch-active class (toggled by JS) */
  .weekly-task-item.touch-active .task-actions,
  .time-slot-task.touch-active .task-actions {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    bottom: 100%;
    top: auto;
    margin-bottom: 4px;
    flex-wrap: wrap;
    max-width: 180px;
    justify-content: flex-start;
  }
  /* Larger tap targets for action buttons */
  .task-action-btn {
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* --- Touch feedback on tappable elements --- */
  .weekly-btn-icon:active,
  .task-action-btn:active,
  button:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
  }

  /* Remove sticky hover highlights on touch */
  .weekly-btn-icon:hover,
  .task-action-btn:hover {
    background: transparent;
  }

  /* --- Swipe action indicators --- */
  .task-swipe-container {
    position: relative;
    overflow: hidden;
  }
  .task-swipe-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    gap: 6px;
    pointer-events: none;
    transition: opacity 0.15s ease;
  }
  .task-swipe-indicator.complete {
    left: 0;
    background: #22c55e;
    border-radius: 6px 0 0 6px;
  }
  .task-swipe-indicator.delete {
    right: 0;
    background: #ef4444;
    border-radius: 0 6px 6px 0;
    flex-direction: row-reverse;
  }
  .task-swipe-content {
    transition: transform 0.15s ease;
    position: relative;
    z-index: 1;
    background: inherit;
  }
}

/* --- Mobile overflow menu --- */
/* --- Mobile Header (simplified 3-element layout) --- */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  padding-top: calc(4px + env(safe-area-inset-top, 0px));
  min-height: 48px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.mobile-header-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-header-btn:active {
  background: rgba(0, 0, 0, 0.06);
  transform: scale(0.92);
}
.dark-mode .mobile-header-btn:active {
  background: rgba(255, 255, 255, 0.08);
}
.mobile-header-date {
  flex: 1;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.mobile-header-date:active {
  opacity: 0.7;
}

/* --- Mobile Quick Actions in Sidebar --- */
.mobile-quick-nav-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  background: var(--weekly-settings-toggle-bg, #f3f4f6);
  color: var(--weekly-text, #333);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-quick-nav-btn:active {
  background: var(--weekly-teal, #0ea5e9);
  color: #fff;
  transform: scale(0.92);
}
.mobile-quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--weekly-text, #374151);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.mobile-quick-action-btn:active {
  background: var(--weekly-settings-toggle-bg, #f3f4f6);
}

/* --- Floating Action Button --- */
.mobile-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0ea5e9;
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mobile-fab:active {
  transform: scale(0.9);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}
.mobile-fab.active {
  background: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* --- FAB Quick Menu --- */
.mobile-fab-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 899;
  animation: fadeIn 0.15s ease;
}
.mobile-fab-menu {
  position: fixed;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  z-index: 901;
  animation: fabMenuIn 0.2s ease-out;
}
@keyframes fabMenuIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.mobile-fab-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.mobile-fab-menu-item span {
  background: var(--weekly-bg, #fff);
  color: var(--weekly-text, #333);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}
.mobile-fab-menu-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* --- Bottom Sheet --- */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 950;
  animation: fadeIn 0.2s ease;
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 960;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  animation: slideUp 0.25s ease;
}
.dark .bottom-sheet {
  background: #1f2937;
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 0 auto 16px;
}
.dark .bottom-sheet-handle {
  background: #4b5563;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Mobile date picker modal --- */
.mobile-date-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.mobile-date-picker-overlay > * {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
}

/* ============================================
   UNIFIED SCROLLING FOR TIME GRID VIEWS
   ============================================ */
/* Active time grid container becomes the sole vertical scroll wrapper */
.time-grid-on .time-grid-wrapper {
  overflow-y: scroll !important; /* Force scrollbar space to always exist */
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Force the all-day section to align with the scrollbar-constrained grid below it */
.time-grid-on .all-day-events-section {
  overflow-y: scroll !important;
}

/* Hide the actual scrollbar thumb in the all-day section so it is just transparent reserved space */
.time-grid-on .all-day-events-section::-webkit-scrollbar {
  width: auto;
  background: transparent;
}
.time-grid-on .all-day-events-section::-webkit-scrollbar-thumb {
  background: transparent;
}

/* Disable independent scrolling on all inner grid containers (desktop only) */
@media (min-width: 769px) {
  .time-grid-on .weekly-days-grid,
  .time-grid-on .weekly-day-column,
  .time-grid-on .time-slots-container,
  .time-grid-on .time-column-slots,
  .time-grid-on .time-column {
    overflow-y: visible !important;
    overflow-x: visible !important;
    max-height: none !important;
    min-height: 100% !important;
  }
}
/* Mobile: allow scroll on grid but keep day columns visible for sticky headers */
@media (max-width: 768px) {
  .time-grid-on .weekly-days-grid {
    overflow-y: auto !important;
    overflow-x: clip !important;
  }
  .time-grid-on .weekly-day-column {
    overflow-y: visible !important;
    overflow-x: visible !important;
    max-height: none !important;
  }
  .time-grid-on .time-slots-container,
  .time-grid-on .time-column-slots,
  .time-grid-on .time-column {
    overflow-y: visible !important;
    overflow-x: visible !important;
    max-height: none !important;
  }
}

/* Ensure no rogue scrollbars appear and hide webskit ones */
.time-grid-on .weekly-days-grid::-webkit-scrollbar,
.time-grid-on .weekly-day-column::-webkit-scrollbar,
.time-grid-on .time-slots-container::-webkit-scrollbar,
.time-grid-on .time-column-slots::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.time-grid-on .weekly-days-grid,
.time-grid-on .weekly-day-column,
.time-grid-on .time-slots-container,
.time-grid-on .time-column-slots {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* Make Day and Time Headers Sticky to the top of the viewport */
.time-grid-on .weekly-day-header,
.time-grid-on .time-column-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 40 !important;
  background-color: var(--weekly-bg, white);
  border-bottom: 1px solid var(--weekly-border, #e0e0e0);
}

.dark-mode .time-grid-on .weekly-day-header,
.dark-mode .time-grid-on .time-column-header {
  background-color: var(--weekly-bg, #111) !important;
  border-bottom-color: var(--weekly-border, #333) !important;
}

@media (max-width: 768px) {
  /* Sticky day header: top: 0 relative to the scroll container (time-grid-wrapper) */
  .time-grid-on .weekly-day-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    background-color: var(--weekly-bg, white);
  }
  /* On mobile, time-column-header should NOT be sticky — it wastes vertical space */
  .time-grid-on .time-column-header {
    position: relative !important;
    top: auto !important;
    z-index: auto !important;
  }
}

/* Provide a solid background for the top-left empty corner above the time column */
.time-grid-on .time-column-header {
  z-index: 45 !important;
}

/* ============================================
   ONBOARDING WIZARD
   ============================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.onboarding-card {
  border-radius: 16px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: onboarding-appear 0.3s ease-out;
  position: relative;
}

@keyframes onboarding-appear {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.onboarding-step-forward { animation: ob-slide-right 0.25s ease-out; }
.onboarding-step-backward { animation: ob-slide-left 0.25s ease-out; }

@keyframes ob-slide-right {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes ob-slide-left {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 480px) {
  .onboarding-card {
    width: 100%;
    max-width: 100% !important;
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
  }
}

@media (max-width: 768px) {
  .onboarding-card {
    max-width: 95% !important;
  }
  .onboarding-wide-step {
    flex-direction: column !important;
  }
  .onboarding-wide-step .onboarding-settings-panel {
    width: 100% !important;
    max-height: none !important;
    overflow-y: visible !important;
  }
  .onboarding-wide-step .onboarding-preview-panel {
    min-height: 300px;
  }
}
