/* Touch Overrides
 * Fixes hover-dependent interactions for touch devices (iPad).
 * Uses @media (hover: none) and @media (pointer: coarse) to scope changes.
 */

/* ========================================================================
   HOVER-DEPENDENT ELEMENTS — Always visible on touch devices
   ======================================================================== */

@media (hover: none) {
    /* Task quick actions (due date, priority, more) */
    .task-row .task-quick-actions {
        opacity: 0.6;
        visibility: visible;
    }

    /* Week view add-task button */
    .week-day-add-btn {
        opacity: 0.6;
        visibility: visible;
    }

    /* Board card actions */
    .board-card .card-actions {
        opacity: 0.6;
        visibility: visible;
    }

    /* Note card actions */
    .note-card .note-actions {
        opacity: 0.6;
        visibility: visible;
    }

    /* Project task section header actions */
    .project-task-section-header .section-actions {
        opacity: 0.6;
        visibility: visible;
    }

    /* Calendar event hover actions */
    .calendar-event .event-actions {
        opacity: 0.6;
        visibility: visible;
    }

    /* Timeline task quick actions */
    .calendar-task .task-quick-actions-calendar {
        opacity: 0.6;
        visibility: visible;
    }

    /* Recording action buttons */
    .recording-item .recording-actions {
        opacity: 0.6;
        visibility: visible;
    }
}

/* ========================================================================
   HOVER TOOLTIPS — Disable on touch (use tap instead)
   ======================================================================== */

@media (hover: none) {
    [data-tooltip]:hover::after,
    [data-tooltip]:hover::before {
        display: none;
    }
}

/* ========================================================================
   LARGER TOUCH TARGETS — Meet 44px minimum
   ======================================================================== */

@media (pointer: coarse) {
    /* Timeline time slots */
    .calendar-hour-slot {
        min-height: 52px;
    }

    /* Calendar tasks on timeline */
    .calendar-task {
        min-height: 48px;
    }

    /* Task checkbox */
    .task-checkbox {
        min-width: 44px;
        min-height: 44px;
    }

    /* Sidebar navigation items */
    .sidebar-nav-item {
        min-height: 44px;
    }

    /* Tag chips */
    .tag-chip {
        min-height: 32px;
        padding: 6px 12px;
    }

    /* Priority/date picker buttons */
    .task-meta-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Drag handles — larger hit area */
    .drag-handle,
    .task-drag-handle,
    .section-drag-handle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================================================
   DRAGGING STATE — Prevent scroll during active drag
   ======================================================================== */

body.is-dragging,
body.is-dragging * {
    touch-action: none;
}

/* ========================================================================
   TEXT SELECTION — Easier on touch
   ======================================================================== */

@media (pointer: coarse) {
    /* Prevent accidental text selection when tapping */
    .task-row,
    .note-card,
    .board-card,
    .sidebar-nav-item {
        -webkit-user-select: none;
        user-select: none;
    }

    /* But allow selection in editors and content areas */
    .rich-text-editor,
    .task-title-input,
    .note-title-input,
    textarea,
    input {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* ========================================================================
   SCROLLBAR STYLING — Thin on touch devices
   ======================================================================== */

@media (pointer: coarse) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 2px;
    }
}

/* ========================================================================
   REDUCED MOTION
   ======================================================================== */

@media (prefers-reduced-motion: reduce) {
    body.is-dragging * {
        transition: none !important;
    }
}
