/**
 * iPad & Touch Devices Overrides
 * ==============================================
 * Optimiert alle Formulare, Buttons und Interaktionselemente
 * für die Bedienung mit dem Finger (iPad/Touch).
 *
 * Entspricht Apple Human Interface Guidelines:
 * - Touch Targets min. 44x44 points
 * - Momentum Scrolling für Listen
 * - Sichtbarkeit von Hover-Aktionen
 */

@media (pointer: coarse), (hover: none) {
    :root {
        --header-height: 48px; /* Etwas größer für Touch */
        --header-btn-size: 36px; /* Bessere Treffsicherheit */
    }

    /* 1. TOUCH TARGETS - Mindestgröße für interaktive Elemente */
    button,
    .unified-ctrl-btn,
    .voice-icon-btn,
    .subtask-action-btn,
    .subtask-item-actions i,
    .chat-toolbar .expi-icon,
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 40px;
        min-height: 40px;
    }

    /* 2. FORMS - Größere Abstände und Eingabefelder */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        padding: 12px 16px !important; /* Komfortableres Tippen */
        font-size: 16px !important;   /* Verhindert Auto-Zoom auf iOS bei Focus */
    }

    /* Sliders (Range) touch-ready */
    input[type="range"] {
        height: 30px; /* Dickere Schiene für Finger */
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    /* 3. HOVER ACTIONS - Sichtbarkeit erzwingen */
    /* Elemente, die sonst nur bei Mouse-Over sichtbar wären */
    .subtask-item-actions,
    .delete-btn,
    .edit-btn:not(.always-visible),
    .copy-btn,
    .hover-controls {
        opacity: 0.8 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* 4. MOMENTUM SCROLLING - Flüssiges Scrollen auf iOS */
    .unified-content,
    .chat-content,
    .entity-table-container,
    .ai-company-step-content,
    .results-container,
    .dropdown-menu,
    .scrollable-area {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* 5. GESTURE PROTECTION */
    /* Verhindert versehentliches Markieren von Text beim Swipen */
    .drag-handle,
    .unified-header,
    .business-sidebar-handle {
        user-select: none;
        -webkit-user-select: none;
        touch-action: none; /* Wichtig für Drag-Vorgänge */
    }

    /* 6. VISUAL FEEDBACK - Click/Active State statt Hover */
    .unified-ctrl-btn:active,
    button:active,
    .clickable:active {
        transform: scale(0.92);
        background-color: rgba(var(--color-primary-rgb), 0.2);
    }

    /* Verstecke Tooltips auf Touch (können stören), außer man hält sie gedrückt */
    [data-tooltip]::before,
    [data-tooltip]::after {
        display: none !important;
    }
}

/* Spezifische Form-Fixes */
#quick-capture-modal input,
#quick-capture-modal textarea {
    font-size: 16px !important;
}

.ai-company-form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px !important;
}
