@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --hour-height: 64px; /* 64px per hour */
}

body {
  font-family: var(--font-sans);
  background-color: #08090d;
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.6);
}

/* Dedicated Mini Scrollbars for Isolated Columns */
.column-scrollbar::-webkit-scrollbar {
  width: 5px;
}
.column-scrollbar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.2);
  border-radius: 9999px;
}
.column-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 9999px;
}
.column-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(129, 140, 248, 0.7);
}

/* Glassmorphism Classes */
.glass-panel {
  background: rgba(15, 20, 32, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-card {
  background: rgba(22, 29, 47, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-card-hover {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card-hover:hover {
  background: rgba(30, 41, 67, 0.85);
  transform: translateY(-1px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Active Nav Links */
.nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  border-color: rgba(129, 140, 248, 0.5);
  color: #ffffff;
  box-shadow: 0 4px 20px -2px rgba(99, 102, 241, 0.25);
}

.subnav-link.subnav-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.2) 100%);
  border-color: rgba(129, 140, 248, 0.4);
  color: #ffffff;
  box-shadow: 0 4px 15px -2px rgba(99, 102, 241, 0.2);
}

/* Circular Timer SVG Animation */
.timer-circle-bg {
  stroke: rgba(255, 255, 255, 0.06);
}
.timer-circle-progress {
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease-in-out, stroke 0.5s ease;
}

/* ==================== DAY CALENDAR GRID STYLES ==================== */
.calendar-day-grid {
  position: relative;
  height: 100%;
  max-height: 100%;
  background: rgba(10, 14, 26, 0.6);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  user-select: none;
  touch-action: pan-y;
}

.calendar-day-canvas {
  position: relative;
  width: 100%;
  height: calc(24 * var(--hour-height));
  min-height: calc(24 * var(--hour-height));
}

.grid-hour-row {
  height: var(--hour-height);
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  box-sizing: border-box;
}

.grid-hour-row::after {
  content: '';
  position: absolute;
  left: 56px;
  right: 0;
  top: 50%;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.02);
}

.grid-hour-label {
  position: absolute;
  left: 6px;
  top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  width: 42px;
  text-align: right;
  z-index: 10;
  pointer-events: none;
}

/* Current real time indicator line */
.current-time-marker {
  position: absolute;
  left: 48px;
  right: 0;
  height: 2px;
  background-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  z-index: 25;
  pointer-events: none;
}

.current-time-marker::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* Event / Task Grid Block */
.calendar-grid-block {
  position: absolute;
  box-sizing: border-box;
  border-radius: 0.85rem;
  padding: 6px 10px;
  z-index: 20;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.calendar-grid-block:hover {
  filter: brightness(1.15);
  transform: scale-[1.01];
  z-index: 30;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

/* Google Calendar Style Drag-to-Select Box */
.grid-slot-selection {
  position: absolute;
  left: 56px;
  right: 12px;
  border-radius: 0.85rem;
  background: rgba(99, 102, 241, 0.3);
  border: 1.5px dashed rgba(165, 180, 252, 0.9);
  z-index: 25;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: flex-start;
  padding: 6px 12px;
  box-sizing: border-box;
}

.planner-day-column .grid-slot-selection {
  left: 3px !important;
  right: 3px !important;
  padding: 4px 6px !important;
}

.grid-slot-selection-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(67, 56, 202, 0.9);
  padding: 2px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Empty Space / Free Gap Badge */
.free-space-badge {
  position: absolute;
  left: 56px;
  right: 12px;
  border-radius: 0.75rem;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.015);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  z-index: 10;
}

.free-space-badge:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

/* Toast Animation */
@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.toast-enter {
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Active focus card pulsing */
@keyframes focusPulse {
  0%, 100% {
    border-color: rgba(99, 102, 241, 0.4);
  }
  50% {
    border-color: rgba(168, 85, 247, 0.7);
  }
}
.active-focus-card {
  animation: focusPulse 3s infinite ease-in-out;
}

/* ==================== MULTI-DAY PLANNER CALENDAR ==================== */
.planner-calendar-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: rgba(10, 14, 26, 0.6);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.planner-headers-row {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 20, 32, 0.8);
  backdrop-filter: blur(12px);
  z-index: 30;
  flex-shrink: 0;
}

.planner-header-time-gutter {
  width: 54px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.planner-header-day {
  flex: 1;
  min-width: 130px;
  padding: 8px 6px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.planner-header-day:last-child {
  border-right: none;
}

.planner-header-day.is-today .planner-header-day-num {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.planner-scroll-body {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  touch-action: pan-y pan-x;
}

.planner-grid-wrapper {
  display: flex;
  position: relative;
  height: calc(24 * var(--hour-height) + 80px);
  min-height: calc(24 * var(--hour-height) + 80px);
  width: 100%;
}

.planner-time-axis {
  width: 54px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 25;
  background: rgba(10, 14, 26, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
}

.planner-day-column {
  flex: 1;
  min-width: 130px;
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
}
.planner-day-column:last-child {
  border-right: none;
}

.planner-day-column .grid-hour-row::after {
  left: 0;
}

/* ==================== GLOBAL ACTIVE FOCUS BAR ==================== */
.global-active-focus-bar {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 27, 75, 0.9) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(99, 102, 241, 0.45);
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.2);
  border-radius: 1.25rem;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: toastSlide 0.3s ease-out;
  width: 100%;
  flex-shrink: 0;
}

/* ==================== DRAG & DROP & RESIZE (PLANNER) ==================== */
.task-draggable {
  cursor: grab !important;
  user-select: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.task-draggable:active {
  cursor: grabbing !important;
}
.task-draggable.is-dragging {
  opacity: 0.35 !important;
  transform: scale(0.98);
}

.planner-preset-chip {
  cursor: grab !important;
  user-select: none;
  transition: all 0.15s ease;
}
.planner-preset-chip:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}
.planner-preset-chip:active {
  cursor: grabbing !important;
  transform: scale(0.96);
}

.planner-day-column.drop-target-active {
  background: rgba(99, 102, 241, 0.08) !important;
  outline: 2px dashed rgba(99, 102, 241, 0.5);
  outline-offset: -2px;
}

.drag-ghost-preview {
  position: absolute;
  border-radius: 0.75rem;
  background: rgba(99, 102, 241, 0.35);
  border: 2px dashed #818cf8;
  pointer-events: none;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 8px;
  box-sizing: border-box;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.calendar-block-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  background: transparent;
  z-index: 20;
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-block-resize-handle::after {
  content: '';
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.15s ease;
}
.calendar-block-resize-handle:hover::after,
.calendar-grid-block.is-resizing .calendar-block-resize-handle::after {
  background: #ffffff;
}

.calendar-block-resize-handle-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  background: transparent;
  z-index: 20;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-block-resize-handle-top::after {
  content: '';
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.15s ease;
}
.calendar-block-resize-handle-top:hover::after,
.calendar-grid-block.is-resizing-top .calendar-block-resize-handle-top::after {
  background: #ffffff;
}

.calendar-grid-block.is-moving {
  cursor: grabbing !important;
  opacity: 0.8 !important;
  z-index: 45 !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6) !important;
  transform: scale(1.02);
}

.day-capacity-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 6px;
  margin-top: 3px;
  letter-spacing: 0.02em;
}
.day-capacity-badge.is-ok {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.day-capacity-badge.is-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* ==================== ENHANCED TASK CARDS & BATCH SELECT ==================== */
.task-draggable {
  position: relative;
  transition: all 0.15s ease;
}

.task-draggable.is-selected {
  border-color: rgba(99, 102, 241, 0.6) !important;
  background: rgba(49, 46, 129, 0.25) !important;
}

.task-select-checkbox {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-draggable:hover .task-select-checkbox,
.task-select-checkbox:checked,
.task-draggable.is-selected .task-select-checkbox {
  opacity: 1 !important;
}

.task-drop-target-above {
  border-top: 2px solid #6366f1 !important;
}

.task-drop-target-below {
  border-bottom: 2px solid #6366f1 !important;
}

.btn-task-card-delete {
  opacity: 0;
  transition: all 0.15s ease;
}

.task-draggable:hover .btn-task-card-delete {
  opacity: 1;
}

@media (max-width: 768px) {
  .task-select-checkbox,
  .btn-task-card-delete {
    opacity: 0.7 !important;
  }
}

/* Subtasks inside modal */
.subtask-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.15s ease;
}

.subtask-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.subtask-item.is-done span {
  text-decoration: line-through;
  opacity: 0.5;
}

/* ==================== COLLAPSIBLE SIDEBARS ==================== */
#sidebar-main {
  width: 14rem;
  min-width: 14rem;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.22s cubic-bezier(0.4, 0, 0.2, 1), padding 0.2s ease;
}

#sidebar-main.sidebar-collapsed {
  width: 4.5rem !important;
  min-width: 4.5rem !important;
  padding: 1rem 0.5rem !important;
}

#sidebar-main.sidebar-collapsed #main-sidebar-header {
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.65rem !important;
  padding: 0 !important;
  width: 100% !important;
}

#sidebar-main.sidebar-collapsed #main-sidebar-header > div:first-child {
  justify-content: center !important;
  width: 100% !important;
  gap: 0 !important;
}

#sidebar-main.sidebar-collapsed .sidebar-label,
#sidebar-main.sidebar-collapsed .sidebar-brand-text,
#sidebar-main.sidebar-collapsed .sidebar-shortcut {
  display: none !important;
}

#sidebar-main.sidebar-collapsed #btn-toggle-main-sidebar {
  margin: 0 auto !important;
  width: 2.25rem !important;
  height: 2.25rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0.75rem !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #a5b4fc !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#sidebar-main.sidebar-collapsed #btn-toggle-main-sidebar:hover {
  background: rgba(99, 102, 241, 0.25) !important;
  color: #ffffff !important;
  border-color: rgba(129, 140, 248, 0.4) !important;
}

#sidebar-main.sidebar-collapsed .nav-link {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  width: 100% !important;
}

.secondary-sidebar {
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.secondary-sidebar.is-collapsed {
  display: none !important;
}

/* Secondary Sidebar Toggle Buttons */
.btn-toggle-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.btn-toggle-secondary:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-toggle-secondary.is-active-toggle {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.4);
}

/* ==================== TRELLO / KANBAN BOARD ==================== */
.kanban-board {
  display: flex;
  gap: 1rem;
  height: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.5rem;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  min-width: 290px;
  max-width: 350px;
  flex: 1;
  border-radius: 1.5rem;
  background: rgba(15, 20, 32, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.85rem;
  height: 100%;
  min-height: 0;
}

.kanban-dropzone {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.35rem;
  border-radius: 1rem;
  transition: all 0.2s ease;
}

.kanban-dropzone.drag-over {
  background: rgba(99, 102, 241, 0.12);
  border: 1.5px dashed rgba(129, 140, 248, 0.6);
}

.kanban-card {
  border-radius: 1.1rem;
  background: rgba(22, 29, 47, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.85rem;
  cursor: grab;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  user-select: none;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.45);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.is-dragging {
  opacity: 0.4;
  transform: scale(0.97);
}

/* =========================================================================
   RESPONSIVE & MOBILE UX OPTIMIZATIONS
   ========================================================================= */

/* Safe area for iPhone home indicator and bottom nav */
.safe-area-bottom {
  padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
}

/* Hide scrollbars on subnav strips while keeping scroll functionality */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Mobile Nav Active Indicators */
.mobile-nav-btn.active {
  color: #818cf8 !important;
  background: rgba(99, 102, 241, 0.15);
}
.mobile-nav-btn.active i {
  color: #818cf8 !important;
}

.mobile-subnav-btn.active {
  background: rgba(99, 102, 241, 0.25) !important;
  color: #ffffff !important;
  border-color: rgba(129, 140, 248, 0.5) !important;
  box-shadow: 0 2px 10px -2px rgba(99, 102, 241, 0.3);
}

/* Media Queries for Mobile Screens (<= 768px) */
@media (max-width: 768px) {
  /* Prevent iOS automatic zoom on input focus */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Touch-friendly min heights */
  button,
  .btn-touch {
    min-height: 40px;
  }

  /* Modals on mobile: auto scroll and max height constrained to viewport */
  .modal-dialog-box {
    max-height: 88dvh !important;
    width: 95% !important;
    margin: auto !important;
  }

  /* Hide custom small scrollbars on touch for smoother native flick */
  .column-scrollbar {
    -webkit-overflow-scrolling: touch;
  }
}
