/*
 * Design System - Week View
 *
 * Week grid layout, day columns, time blocks, and interactive states.
 * Based on the design exploration in tmp/week_view_mockup_v11.html
 */

/* ============================================
   Week View Container
   ============================================ */

.week-view {
  /* No padding - main element already provides page padding */
}

/* ============================================
   Week Navigator Header (in week view content, not the main app header)
   ============================================ */

.week-view header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 2px solid var(--parchment);
  position: relative;
}

.week-view header::before {
  content: '✦  ·  ✦  ·  ✦  ·  ✦  ·  ✦  ·  ✦  ·  ✦';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: var(--dusty-rose);
  letter-spacing: 8px;
  opacity: 0.6;
}

.week-view header::after {
  content: '✦';
  position: absolute;
  right: 50%;
  bottom: -12px;
  transform: translateX(50%);
  font-size: 20px;
  color: var(--terra-cotta);
  background: var(--paper-bg);
  padding: 0 var(--space-md);
}

.logo {
  font-family: var(--font-logo);
  font-size: 60px;
  font-weight: 400;
  color: var(--ink-dark);
  letter-spacing: 1px;
  position: relative;
  flex: 1;
}

.logo::after {
  content: '~';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--size-icon);
  color: var(--dusty-rose);
  opacity: 0.5;
}

/* Week range - centered */
.week-range {
  font-family: var(--font-accent);
  font-size: var(--font-size-3xl);
  color: var(--ink-medium);
  letter-spacing: 1px;
  flex: 1;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-buttons {
  display: flex;
  gap: var(--space-md);
  flex: 1;
  justify-content: flex-end;
}

/* ============================================
   Week Grid
   ============================================ */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-lg);
  max-width: 1600px;
  margin: 0 auto;
}

@media (min-width: 1800px) {
  .week-grid {
    max-width: 1800px;
  }
}

/* ============================================
   Day Columns
   ============================================ */

.day-column {
  background: rgba(255, 255, 255, 0.6);
  padding: var(--space-lg);
  position: relative;
  min-height: 600px;
  border: none;
  text-decoration: none;

  /* Subtle shadow for depth */
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    3px 3px 0 rgba(0, 0, 0, 0.08);

  /* Smooth transitions */
  transition: all var(--transition-base);
}

/* Texture overlay for day column - single layer per column */
.day-column::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='3' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.3'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.15;
  z-index: 0;
}

/* Day header link - clickable area for navigating to day view */
.day-header-link {
  display: block;
  text-decoration: none;
  color: inherit;
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: opacity var(--transition-base);
}

.day-header-link:hover {
  opacity: 0.8;
}

/* Preserve rotation on hover by using CSS variable */
.day-column:nth-child(1) { --rotate: -0.4deg; transform: rotate(-0.4deg); }
.day-column:nth-child(2) { --rotate: 0.3deg; transform: rotate(0.3deg); }
.day-column:nth-child(3) { --rotate: -0.2deg; transform: rotate(-0.2deg); }
.day-column:nth-child(4) { --rotate: 0.4deg; transform: rotate(0.4deg); }
.day-column:nth-child(5) { --rotate: -0.3deg; transform: rotate(-0.3deg); }
.day-column:nth-child(6) { --rotate: 0.2deg; transform: rotate(0.2deg); }
.day-column:nth-child(7) { --rotate: -0.2deg; transform: rotate(-0.2deg); }

/* SVG border positioned absolutely */
.day-column .border-svg {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  pointer-events: none;
  z-index: 0;
}

/* Content sits above SVG border and texture overlay */
.day-column > *:not(.border-svg) {
  position: relative;
  z-index: 1;
}

.day-name {
  font-family: var(--font-handwritten);
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 var(--space-xs) 0;
  color: var(--ink-dark);
  text-align: center;
  position: relative;
}

.day-name::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--dusty-rose);
  opacity: 0.4;
  border-radius: 2px;
}

/* Hide underline when notes are expanded */
.day-header-link.notes-expanded .day-name::after {
  display: none;
}

.day-date {
  font-family: var(--font-accent);
  font-size: var(--size-icon);
  text-align: center;
  color: var(--ink-medium);
  margin: 0;
  letter-spacing: 1px;
}

/* Decorative elements */
.day-column .decoration-star {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 14px;
  color: var(--dusty-rose);
  opacity: 0.5;
  z-index: 1;
}

.day-column .decoration-accent {
  position: absolute;
  top: 24px;
  left: 12px;
  font-size: var(--size-icon);
  color: var(--terra-cotta);
  opacity: 0.3;
  z-index: 1;
}

/* ============================================
   Time Blocks
   ============================================ */

.time-blocks {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.time-block {
  padding: var(--space-md);
  border-radius: 5px;
  position: relative;
  transition: all var(--transition-base);
  border: 2px solid transparent;
  overflow: hidden;
}

/* Draggable blocks show grab cursor */
.time-block[draggable="true"] {
  cursor: grab;
}

.time-block[draggable="true"]:active {
  cursor: grabbing;
}

/* Immovable blocks (calendar events) and "do on" blocks show forbidden cursor */
.time-block[draggable="false"],
.time-block[data-immovable="true"] {
  cursor: not-allowed;
  user-select: none;
  -webkit-user-drag: none;
}

/* Ensure fixed-to-date blocks also get the forbidden cursor with higher specificity */
.time-block[draggable="false"].fixed-to-date,
.time-block[data-fixed-to-date="true"] {
  cursor: not-allowed !important;
}

/* Texture overlay removed from individual blocks to prevent stacking
   (now applied once per day-column instead) */

/* Watercolor blur effect on hover */
.time-block::before {
  content: '';
  position: absolute;
  inset: -6px;
  opacity: 0;
  filter: blur(12px);
  transition: opacity var(--transition-base);
  z-index: -1;
  border-radius: var(--border-radius-lg);
}

.time-block:hover::before {
  opacity: 0.6;
}

/* Week-specific time block overrides */
.time-block.immovable .block-title,
.time-block.immovable .block-time {
  color: white;
}

.time-block.immovable .block-time {
  opacity: 0.85;
}

/* NOTE: Color gradient classes for time blocks are now in time-blocks.css
   to make them globally available across all views (week, day, etc.) */

/* ============================================
   Time Block Content
   ============================================ */

/* Week block tasks list */
.week-block-tasks {
  margin-top: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-block-task {
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.week-block-task-title {
  font-size: 13px;
  line-height: 1.3;
  display: block;
}

/* Completed task styling in week view - just strikethrough */
.week-block-task.task-completed .week-block-task-title {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Block with all tasks complete - golden glow */
.time-block.block-all-complete {
  background: linear-gradient(135deg, var(--color-completed-bg) 0%, var(--color-completed-bg-dark) 100%);
  border-color: var(--color-completed-border);
}

.time-block.block-all-complete::before {
  background: var(--color-completed-checkbox);
}

.time-block.block-all-complete .block-title,
.time-block.block-all-complete .block-time {
  opacity: 0.85;
}

.block-time {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 400;
  display: block;
  margin-bottom: var(--space-xs);
  opacity: 0.7;
  letter-spacing: 0.3px;
}

.block-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  display: block;
  letter-spacing: 0.2px;
  position: relative;
  z-index: 1;
}

@media (min-width: 1800px) {
  .day-column {
    padding: var(--space-xl);
  }
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

@media (max-width: 768px) {
  /* Week view - no changes to grid for now, but adjust spacing */
  .week-view {
    /* User requested no changes to week view for mobile yet */
  }

  /* Week navigator - more compact on mobile */
  .week-view header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
  }

  /* Week range title - smaller on mobile */
  .week-view header h1 {
    font-size: 24px !important;
  }

  /* Navigation buttons - smaller on mobile */
  .nav-buttons {
    gap: var(--space-sm);
  }

  .nav-buttons .btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
  }

  .nav-buttons .btn-text {
    font-size: var(--font-size-sm);
  }

  /* Week grid - maintain 7 columns but with tighter spacing */
  .week-grid {
    gap: var(--space-xs);
  }

  /* Day columns - more compact */
  .day-column {
    padding: var(--space-sm);
    min-height: 400px;
  }

  /* Day header - smaller fonts */
  .day-name {
    font-size: var(--font-size-sm);
  }

  .day-date {
    font-size: var(--font-size-xs);
  }

  /* Week all-day badges - more compact */
  .week-all-day-badges {
    gap: var(--space-2xs);
    margin-bottom: var(--space-xs);
  }

  .week-all-day-badge {
    padding: var(--space-2xs) var(--space-xs);
    font-size: var(--font-size-xs);
  }

  /* Time blocks in week view - more compact */
  .week-grid .time-block {
    padding: var(--space-xs);
    margin-bottom: var(--space-xs);
  }

  .week-grid .block-time {
    font-size: var(--font-size-xs);
  }

  .week-grid .block-title {
    font-size: var(--font-size-xs);
  }

  /* Week block tasks - smaller on mobile */
  .week-block-tasks {
    gap: var(--space-2xs);
  }

  .week-block-task {
    padding: var(--space-2xs);
  }

  .week-block-task-title {
    font-size: var(--font-size-xs);
  }
}

/* ============================================
   Drag and Drop States
   ============================================ */

/* Dragging state - make block semi-transparent */
.time-block.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

/* Dropzone hover - warm glow effect for day column */
.day-column.drag-over {
  background: linear-gradient(
    180deg,
    rgba(217, 165, 154, 0.12) 0%,
    rgba(201, 165, 147, 0.08) 100%
  );
  border: 2px solid var(--terra-cotta);
  box-shadow:
    0 0 0 2px rgba(201, 165, 147, 0.15),
    inset 0 2px 6px rgba(201, 165, 147, 0.1);
}

/* Invalid drop - subtle rejection feel */
.day-column.drag-invalid {
  background-color: rgba(239, 68, 68, 0.04);
  border: 2px solid rgba(239, 68, 68, 0.25);
  cursor: not-allowed;
}
