/* kalender-responsive.css — ALL @media blocks consolidated */
/* Auto-split from kalender.css + kalender-ai.css — 649 lines */

/* ════════════════════════════════════════════════════════════
   MOBILE SEGMENTED VIEW SWITCHER (replaces dropdown < 768px)
   ════════════════════════════════════════════════════════════ */

.cal-view-segmented {
  display: none; /* shown via JS on mobile */
  justify-content: center;
  gap: 0;
  padding: 4px 12px 8px;
  background: transparent;
}

.cal-view-segmented .cal-view-seg-btn {
  flex: 1;
  max-width: 120px;
  height: 44px;
  padding: 0 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  background: var(--color-card, #fff);
  color: var(--color-text-secondary, rgb(60, 60, 58));
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
  outline: none;
}

/* Pill shape: round outer ends, flat inner joins */
.cal-view-segmented .cal-view-seg-btn:first-child {
  border-radius: 100px 0 0 100px;
  border-right: none;
}
.cal-view-segmented .cal-view-seg-btn:last-child {
  border-radius: 0 100px 100px 0;
  border-left: none;
}
.cal-view-segmented .cal-view-seg-btn:not(:first-child):not(:last-child) {
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* Active segment */
.cal-view-segmented .cal-view-seg-btn.active {
  background: var(--color-text-primary);
  color: #fff;
  border-color: var(--color-text-primary);
  z-index: 1;
}

/* Restore borders on neighbors of active */
.cal-view-segmented .cal-view-seg-btn.active + .cal-view-seg-btn {
  border-left: 0.5px solid var(--color-text-primary);
}

/* Focus-visible for keyboard accessibility */
.cal-view-segmented .cal-view-seg-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(31, 31, 30, 0.3);
  z-index: 2;
}

/* Dark mode */
[data-theme="dark"] .cal-view-segmented .cal-view-seg-btn {
  background: var(--color-card, #2b3348);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
}
[data-theme="dark"] .cal-view-segmented .cal-view-seg-btn.active {
  background: var(--color-primary, #696cff);
  border-color: var(--color-text-primary);
  color: #fff;
}

@media (max-width: 767px) {
  .cal-view-segmented {
    display: flex;
  }
}

/* === From kalender.css === */


@media (max-width: 767px) {
  .cal-briefing {
    margin: 8px 12px 0;
    padding: 12px 14px;
  }

  .cal-briefing-greeting {
    font-size: 14px;
  }

  .cal-briefing-stats {
    gap: 8px;
  }

  .cal-briefing-stat {
    padding: 6px 12px;
    min-width: 56px;
  }

  .cal-briefing-stat-num {
    font-size: 18px;
  }
}

@media (max-width: 767px) {
  .cal-main {
    padding: 0 !important;
    overflow: hidden;
  }

  /* Sidebar hidden globally — mobile layout adjustments only */
  .cal-layout {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }

  /* ── Toolbar + calendar body ── */
  .cal-body {
    padding: 0;
    overflow: hidden;
  }

  .cal-body #calendar {
    padding: 10px 10px 140px; /* room for floating AI bar + mobile nav */
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Toolbar mobile overrides → moved to main mobile toolbar block below */

  /* ── Grid adjustments ── */
  .cal-body .fc-col-header-cell {
    font-size: 10px;
    padding: 6px 0;
  }

  .cal-body .fc-daygrid-day-number {
    font-size: 12px;
    padding: 3px 4px;
  }

  .cal-body .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    width: 24px;
    height: 24px;
    margin: 2px 4px;
  }

  .cal-body .fc-daygrid-day-frame {
    min-height: 52px;
  }

  /* ── 6. Event text: 11px minimum (was 10px — too small) ── */
  .cal-body .fc-event {
    font-size: 11px !important;
    padding: 2px 5px 2px 7px !important;
    border-left-width: 2px !important;
    line-height: 1.35 !important;
    border-radius: 6px !important;
  }

  .cal-body .fc-event:hover {
    transform: none;
    box-shadow: none;
  }

  /* ── 5. Drawer → slide up from bottom (sheet-style) ── */
  .cal-drawer {
    width: 100%;
    height: auto;
    max-height: 92dvh;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .cal-drawer-overlay.active .cal-drawer {
    transform: translateY(0);
  }

  /* Swipe-down-to-close gesture hint (handle bar) */
  .cal-drawer::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }

  .cal-drawer-header {
    padding: 12px 20px 16px;
  }

  .cal-drawer-body {
    padding: 16px 20px;
    max-height: calc(92dvh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cal-drawer-footer {
    padding: 14px 20px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  /* Drawer buttons — 44px touch targets */
  .cal-drawer-footer .btn,
  .cal-drawer-footer .btn-delete {
    min-height: 44px;
    padding: 10px 20px;
  }

  /* ── 4. Touch targets for all interactive elements ── */
  .cal-add-cat-btn,
  .cal-reset-cats,
  .cal-drawer-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Time grid — mobile */
  .cal-body .fc-timegrid-slot {
    height: 40px;
  }

  .cal-body .fc-timegrid-slot-label {
    width: 40px;
  }

  .cal-body .fc-timegrid-slot-label-cushion {
    font-size: 10px;
    padding-right: 4px;
  }

  .cal-body .fc-timegrid-event {
    font-size: 11px !important;
    padding: 2px 4px 2px 6px !important;
    border-left-width: 3px !important;
    border-radius: 6px !important;
    line-height: 1.3 !important;
  }

  .cal-body .fc-timegrid-event .fc-event-time {
    font-size: 11px !important;
  }

  .cal-body .fc-timegrid-event:hover {
    transform: none;
    box-shadow: none;
  }

  .cal-body .fc-timegrid-now-indicator-arrow {
    width: 8px;
    height: 8px;
    margin-top: -4px;
  }

  .cal-body .fc-timegrid-axis {
    width: 40px;
  }

  .cal-body .fc-timegrid .fc-col-header-cell-cushion {
    font-size: 10px;
    padding: 2px 4px;
  }

  /* List view — mobile */
  .cal-body .fc-list-day-cushion {
    padding: 10px 14px !important;
  }

  .cal-body .fc-list-day-text {
    font-size: 13px !important;
  }

  .cal-body .fc-list-day-side-text {
    font-size: 11px !important;
  }

  .cal-body .fc-list-event td {
    padding: 10px 12px !important;
  }

  .cal-body .fc-list-event-time {
    font-size: 12px !important;
    min-width: 70px;
    max-width: 80px;
    padding-left: 10px !important;
  }

  .cal-list-card__title {
    font-size: 14px;
  }

  .cal-list-card__chip {
    font-size: 10px;
    padding: 1px 6px;
  }

  .cal-list-card__desc {
    font-size: 12px;
    max-width: 250px;
  }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Small mobile (≤375px)
   ════════════════════════════════════════════════════════════ */

@media (max-width: 375px) {
  .cal-body .fc-toolbar-title {
    font-size: 15px !important;
  }

  .cal-body .fc-col-header-cell { font-size: 10px; }
  .cal-body .fc-daygrid-day-number { font-size: 11px; }
}

@media (max-width: 767px) and (max-height: 500px) and (orientation: landscape) {
  .cal-body {
    padding: 6px 8px 40px;
  }

  .cal-body .fc-toolbar {
    gap: 4px;
    margin-bottom: 6px !important;
  }

  .cal-body .fc-toolbar-title {
    font-size: 15px !important;
  }

  .cal-body .fc-daygrid-day-frame {
    min-height: 36px;
  }

  .cal-body .fc-daygrid-day-number {
    font-size: 11px;
    padding: 2px 3px;
  }

  .cal-body .fc-event {
    font-size: 10px !important;
    padding: 1px 4px 1px 5px !important;
  }

  /* Drawer: compact in landscape */
  .cal-drawer {
    max-height: 85dvh;
  }
}

@media (max-width: 767px) {
  .cal-event-popup { display: none !important; }
}

@media (max-width: 575px) {
  .cal-confirm-card {
    padding: 24px 20px 18px;
    border-radius: 12px;
  }
  .cal-confirm-actions {
    flex-direction: column-reverse;
  }
}

@media (max-width: 575px) {
  .cal-quick-add {
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.15);
  }
  .cal-quick-add.active {
    display: flex;
  }
  .cal-quick-add-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: calc(100% - 24px);
    max-width: 400px;
    margin-bottom: 80px;
    border-radius: 12px;
    animation-name: qaSlideUp;
  }
  @keyframes qaSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
[data-theme="dark"] .cal-quick-add-save {
  background: #fff;
  color: var(--color-text-primary);
}
@media (hover: hover) {
  [data-theme="dark"] .cal-quick-add-save:hover {
    background: #f0f0f0;
  }
}

/* ── QA fixes: pointer-events, touch targets, hint contrast ── */
.cal-quick-add:not(.active) {
  pointer-events: none;
}
[data-theme="dark"] .cal-quick-add-hint {
  color: rgba(255, 255, 255, 0.35);
}
@media (max-width: 575px) {
  .cal-quick-add-save {
    min-height: 44px;
    padding: 10px 24px;
    font-size: 14px;
  }
  .cal-quick-add-details {
    min-height: 44px;
    padding: 10px 12px;
  }
  .cal-quick-add-input {
    font-size: 16px;
    padding: 12px 18px 10px;
  }
}

@media (max-width: 767px) {
  /* Single-row toolbar: nav left, filter+dropdown right */
  .cal-body .fc-toolbar.fc-header-toolbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    padding: 10px 12px 6px !important;
    margin-bottom: 6px !important;
    align-items: center !important;
  }

  /* Chunk 1 (left: today,prev,next,title) — flex grow */
  .cal-body .fc-toolbar .fc-toolbar-chunk:first-child {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  /* Chunk 2 (center: empty) → collapse */
  .cal-body .fc-toolbar .fc-toolbar-chunk:nth-child(2) {
    display: none !important;
  }

  /* Chunk 3 (right: filter+dropdown) */
  .cal-body .fc-toolbar .fc-toolbar-chunk:last-child {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  /* Hide I dag — tap today's date cell instead */
  .cal-body .fc-today-button { display: none !important; }

  /* Hide + Ny begivenhed — use date click or NL bar */
  .cal-body .fc-addEvent-button { display: none !important; }

  /* Prev/Next: 44px touch target, borderless, round */
  .cal-body .fc-prev-button,
  .cal-body .fc-next-button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: transparent !important;
    border: none !important;
    color: var(--color-text-secondary, rgb(60, 60, 58)) !important;
    box-shadow: none !important;
  }

  /* Title: clean */
  .cal-body .fc-toolbar-title {
    font-size: 15px !important;
    font-weight: 650 !important;
    margin: 0 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* View dropdown: 44px touch target */
  .fc-viewDropdown-button.fc-button {
    font-size: 12px !important;
    padding: 0 10px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  /* Filter button: 44px touch target */
  .fc-filterCats-button.fc-button {
    font-size: 12px !important;
    padding: 0 10px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  /* prev/next button group wrapper — no border */
  .cal-body .fc-toolbar .fc-button-group {
    width: auto !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    display: flex !important;
    gap: 0 !important;
  }
  .cal-body .fc-toolbar .fc-button-group .fc-button {
    flex: 0 !important;
    border-right: none !important;
  }

  /* Dark mode mobile */
  [data-theme=dark] .cal-body .fc-prev-button,
  [data-theme=dark] .cal-body .fc-next-button {
    color: rgba(255,255,255,0.7) !important;
  }

  /* ── Bug fix: event chip touch targets (19-24px → 28px min) ── */
  .cal-body .fc-event,
  .cal-body .fc-daygrid-event {
    min-height: 40px !important;
    padding: 4px 6px 4px 8px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* ── Bug fix: event chip font too small (11px → 13px) ── */
  .cal-body .fc-event .fc-event-title,
  .cal-body .fc-event .fc-event-time,
  .cal-body .fc-daygrid-event .fc-event-title,
  .cal-body .fc-daygrid-event .fc-event-time {
    font-size: 13px !important;
    line-height: 1.3 !important;
  }

  /* ── Bug fix: day header font too small (10px → 12px) ── */
  .cal-body .fc-col-header-cell-cushion {
    font-size: 12px !important;
  }

  /* ── Bug fix: date numbers slightly too small (13px → 14px) ── */
  .cal-body .fc-daygrid-day-number {
    font-size: 14px !important;
  }
}


@media (max-width: 576px) {

  /* NL textarea — slightly smaller on mobile */
  .smart-drawer-nl-group .smart-drawer-nl-input {
    min-height: 56px;
    font-size: 14px;
  }

  /* AI badges — tighter on small screens */
  .ai-field-badge {
    font-size: 9px;
    padding: 1px 4px;
  }

  /* Details toggle — 44px touch target */
  .smart-drawer-details-toggle {
    min-height: 44px;
    padding: 12px 0;
  }

  /* Preview card — less padding */
  .smart-drawer-preview {
    padding: 8px 12px;
    font-size: 12px;
  }
}


/* === From kalender-ai.css === */


@media (max-width: 767px) {
  .nl-bar-label { display: none; }

  .nl-bar {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    width: auto;
    left: 10px;
    right: 10px;
    max-width: none;
    transform: none;
    z-index: 101;
  }

  .nl-bar-inner {
    border-radius: 12px;
    padding: 2px 10px;
  }

  .nl-bar-input {
    font-size: 16px;
    padding: 10px 0;
    min-height: 44px;
  }

  .nl-bar-hints { display: none; }
  .nl-bar-shortcut { display: none; }

  .nl-bar-submit,
  .nl-bar-mic {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
  }

  /* Cards — full width, comfortable padding */
  .nl-result,
  .nl-clarify,
  .nl-answer,
  .nl-query-results,
  .nl-modify-confirm,
  .nl-delete-confirm,
  .nl-slot-suggestions,
  .nl-study-plan {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  .nl-result-body {
    flex-direction: column;
    gap: 5px;
  }

  /* Touch-friendly buttons (44px min tap target) */
  .nl-result-actions .btn,
  .nl-overlay-actions .btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }

  .nl-result-dismiss,
  .nl-answer-dismiss {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
  }

  /* Answer card dismiss repositioned for mobile */
  .nl-answer {
    padding-right: 44px;
  }

  .nl-answer-dismiss {
    top: 6px;
    right: 4px;
  }

  /* Clarify chips — bigger tap targets */
  .nl-clarify-chip {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  /* Slot grid — single column on mobile */
  .nl-slot-grid {
    grid-template-columns: 1fr;
  }

  .nl-slot-card {
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 14px;
    min-height: 44px;
  }

  .nl-overlay-list {
    max-height: 200px;
  }

  /* Undo toast — wider on mobile, above bottom bar */
  .nl-undo-toast {
    bottom: 140px;
    left: 12px;
    right: 12px;
    transform: none;
    justify-content: center;
    border-radius: var(--radius-lg, 12px);
    padding: 10px 16px;
  }

  .nl-undo-toast--exiting {
    animation: nl-card-exit 0.2s ease both;
  }

  /* Loading card */
  .nl-loading {
    padding: 10px 12px;
  }
}

/* Landscape phone — compact layout */
@media (max-width: 767px) and (max-height: 500px) and (orientation: landscape) {
  .nl-bar { bottom: 8px; }

  .nl-bar-input {
    font-size: 13px;
    padding: 6px 0;
    min-height: 36px;
  }

  .nl-bar-submit,
  .nl-bar-mic {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
}

@media (pointer: coarse) {
  .cal-body .fc-event {
    min-height: 40px !important;
    padding: 6px 10px 6px 9px !important;
  }
  .cal-body .fc-timegrid-event {
    min-height: 44px !important;
  }
}

@media (pointer: coarse) {
  .cal-event-popup {
    display: none !important;
  }
}

/* ════════════════════════════════════════════════════════════
   REDUCED MOTION — disable animations & transitions
   ════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .cal-drawer {
    transition: none !important;
  }

  .cal-drawer-overlay.active .cal-drawer {
    transition: none !important;
  }

  .cal-quick-add-card {
    animation: none !important;
  }

  .nl-undo-toast--exiting {
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════
   TABLET BREAKPOINTS (768px–1279px)
   ════════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1023px) {
  .cal-body #calendar {
    padding: 0 14px 96px;
  }

  .cal-body .fc-toolbar {
    padding: 14px 14px 0;
  }

  .cal-body .fc-toolbar-title {
    font-size: 15px !important;
  }

  .cal-body .fc-daygrid-day-number {
    font-size: 13px;
    padding: 6px 8px;
  }

  .cal-body .fc-event {
    font-size: 12px !important;
  }

  .cal-drawer {
    width: 360px;
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .cal-body .fc-toolbar {
    padding: 14px 16px 0;
  }

  .cal-drawer {
    width: 380px;
  }
}

