/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE.CSS — iplanlane Gantt
   v2.0 — Bereinigt: keine Änderungen an Quick-Actions, Resizer
   oder Icon-Größen. Auth-Landscape komplett gefixt.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. TABLETS LANDSCAPE + KLEINE LAPTOPS (≤1280px) ─────────── */
@media (max-width: 1280px) {
    .app-layout {
        padding: calc(16px + var(--sa-top)) calc(16px + var(--sa-right))
                 calc(16px + var(--sa-bottom)) calc(16px + var(--sa-left));
        gap: 16px;
    }
    header.glass-card { padding: 12px 20px !important; }
    .gantt-modal { width: 380px; padding: 24px; }
}

/* ── 2. TABLETS PORTRAIT + IPAD SPLIT-VIEW (≤920px) ──────────── */
@media (max-width: 920px) {
    .app-layout {
        padding: calc(12px + var(--sa-top)) calc(10px + var(--sa-right))
                 calc(12px + var(--sa-bottom)) calc(10px + var(--sa-left));
        gap: 12px;
    }
    header.glass-card { flex-wrap: wrap; gap: 10px; padding: 12px 16px !important; border-radius: 14px; }
    .logo { font-size: 20px; }
    #plan-selector-wrap { order: 3; max-width: 100%; width: 100%; margin: 0; }
    .nav-new-task-btn { padding: 8px 14px; font-size: 12px; }
    .nav-ai-btn { padding: 7px 12px; font-size: 12px; }
    .theme-switcher { gap: 1px; padding: 3px; }
    .theme-btn { width: 28px; height: 28px; }
    .gantt-label-header, .gantt-label-header-inner, .task-label,
    .gantt-label-toggle-btn, .gantt-month-label-spacer {
        width: 200px !important; min-width: 200px !important;
    }
    .gantt-container.glass-card { border-radius: 14px; padding: 0; }
    .gantt-zoom-bar {
        border-radius: 14px 14px 0 0;
        padding: 8px 10px;
        gap: 4px;
        flex-wrap: wrap;
        height: auto;
        min-height: 44px;
        justify-content: flex-start;
        row-gap: 6px;
    }
    .gantt-zoom-slider { max-width: 100px; }
    .gantt-view-btn { padding: 5px 8px; font-size: 11px; }
    .gantt-zoom-settings-btn { width: 30px; height: 30px; }
    .gantt-fab-add { width: 56px; height: 56px; right: 14px; }
    .gantt-fab-add svg { width: 36px; height: 36px; }
    .gantt-modal { width: calc(100% - 32px); max-width: 420px; padding: 24px; border-radius: 22px; }
    .editor-modal-box { max-width: calc(100% - 24px); }
    .ai-modal-box { max-width: calc(100% - 24px); }
    .export-modal-box { max-width: calc(100% - 24px); margin: 12px; }
    .gantt-month-bar { top: 36px; }
    .gantt-header { height: 50px; top: 68px; }
}

/* ── 3. GROẞE SMARTPHONES (≤600px) ───────────────────────────── */
@media (max-width: 600px) {
    .app-layout {
        padding: calc(8px + var(--sa-top)) calc(6px + var(--sa-right))
                 calc(8px + var(--sa-bottom)) calc(6px + var(--sa-left));
        gap: 8px;
    }
    header.glass-card { padding: 10px 12px !important; border-radius: 12px; gap: 8px; }
    .logo { font-size: 18px; letter-spacing: -1px; }
    .nav-new-task-btn span, .nav-ai-btn span:last-child { display: none; }
    .nav-new-task-btn { padding: 8px 10px; gap: 0; }
    .nav-ai-btn { padding: 7px 10px; gap: 0; }
    #account-menu-username { display: none !important; }
    #account-chevron { display: none !important; }
    /* Theme-Switcher (Glass/Hell/Dunkel) mobil ausblenden — er ist bereits
       im "Mehr"-Sheet der unteren Navigationsleiste eingegliedert. */
    .theme-switcher { display: none !important; }
    #account-menu-btn { padding: 8px 10px !important; gap: 0 !important; }
    #collab-invite-btn span:not(#collab-invite-badge) { display: none; }
    #collab-invite-btn { padding: 8px 10px; gap: 0; }
    .nav-admin-link { padding: 6px 10px; font-size: 10px; }
    #plan-selector-wrap { order: 3; margin: 0; max-width: 100%; }
    .plan-selector-btn { padding: 8px 12px; font-size: 12px; border-radius: 10px; }
    .plan-dropdown-menu { border-radius: 14px; }
    .gantt-label-header, .gantt-label-header-inner, .task-label,
    .gantt-label-toggle-btn, .gantt-month-label-spacer {
        width: 160px !important; min-width: 160px !important;
    }
    .gantt-label-header-progress { width: 50px; min-width: 50px; font-size: 10px; }
    .task-label-status { width: 50px; min-width: 50px; }
    .task-label-title { padding: 0 10px; font-size: 11px; }
    .gantt-container {
        --row-height: 54px; --bar-height: 28px; --bar-top: 13px;
        --bar-font: 10px; --bar-pct: 8px; --label-font: 11px;
    }
    .gantt-zoom-bar {
        min-height: 40px;
        height: auto;
        padding: 6px 8px;
        gap: 4px;
        border-radius: 12px 12px 0 0;
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .gantt-zoom-btn { width: 32px; height: 32px; }
    .gantt-zoom-slider { max-width: 100px; flex: 1; min-width: 70px; }
    .gantt-zoom-divider { margin: 0 2px; height: 18px; }
    .gantt-zoom-fit-btn span, .gantt-zoom-today-btn span { display: none; }
    .gantt-zoom-fit-btn, .gantt-zoom-today-btn { padding: 6px 8px; min-width: 32px; min-height: 32px; }
    .gantt-zoom-export-btn span { display: none; }
    .gantt-zoom-export-btn { padding: 6px 8px; min-width: 32px; min-height: 32px; }
    .gantt-zoom-settings-btn { width: 32px; height: 32px; }
    .gantt-view-btn { padding: 5px 9px; font-size: 11px; min-height: 28px; }
    .gantt-view-switcher { height: auto; }
    .gantt-container.glass-card { border-radius: 12px; }
    .gantt-fab-add { width: 50px; height: 50px; right: 10px; }
    .gantt-fab-add svg { width: 32px; height: 32px; }
    .gantt-modal { width: calc(100% - 16px); max-width: 100%; padding: 20px; border-radius: 20px; max-height: 85vh; overflow-y: auto; }
    .editor-modal-box { max-width: 100%; margin: 8px; }
    .editor-card { padding: 20px 18px 18px !important; border-radius: 18px; }
    .editor-fields { gap: 10px; }
    .editor-field-half { flex: 1 1 100% !important; max-width: 100% !important; }
    .editor-save-btn { padding: 12px; font-size: 13px; }
    .ai-modal-overlay { padding: 8px; align-items: flex-end; }
    .ai-modal-box { max-width: 100%; max-height: 92vh; }
    .ai-modal-card { border-radius: 20px 20px 0 0; max-height: 92vh; }
    .ai-chat-messages { min-height: 180px; max-height: 50vh; padding: 12px 14px; }
    .ai-message-bubble { max-width: 90%; font-size: 13px; }
    .export-modal-box { margin: 8px; border-radius: 20px; }
    .export-formats { gap: 6px; padding: 12px 16px 16px; }
    .export-format-btn { padding: 12px 6px; font-size: 10px; border-radius: 12px; }
    .gantt-modal .modal-group input[type="date"] { font-size: 13px; padding: 12px; }
    .task-info-popup-portal { max-width: 240px; min-width: 180px; padding: 10px 12px; border-radius: 12px; }
    .legal-footer { padding: 12px 16px; font-size: 11px; }
    .legal-footer-inner { gap: 6px; }
    .legal-modal-box { max-width: calc(100% - 16px); margin: 8px; border-radius: 16px; }
    .gantt-month-bar { top: 32px; height: 28px; }
    .month-cell { font-size: 10px; }
    .gantt-header { height: 44px; top: 60px; }
    .timeline-day-cell { font-size: 11px !important; }
    .gantt-container.labels-collapsed .gantt-label-header,
    .gantt-container.labels-collapsed .task-label,
    .gantt-container.labels-collapsed .gantt-label-toggle-btn,
    .gantt-container.labels-collapsed .gantt-month-label-spacer { width: 50px !important; min-width: 50px !important; }
    .gantt-container.labels-collapsed .task-label-status { width: 50px !important; min-width: 50px !important; }
    #cookie-consent-banner { padding: 16px !important; border-radius: 16px 16px 0 0 !important; font-size: 13px !important; }
}

/* ── 4. KLEINE SMARTPHONES (≤420px) ──────────────────────────── */
@media (max-width: 420px) {
    .app-layout {
        padding: calc(6px + var(--sa-top)) calc(4px + var(--sa-right))
                 calc(6px + var(--sa-bottom)) calc(4px + var(--sa-left));
        gap: 6px;
    }
    header.glass-card { padding: 8px 10px !important; border-radius: 10px; }
    .logo { font-size: 16px; }
    .gantt-label-header, .gantt-label-header-inner, .task-label,
    .gantt-label-toggle-btn, .gantt-month-label-spacer {
        width: 120px !important; min-width: 120px !important;
    }
    .gantt-label-header-progress, .task-label-status { width: 40px; min-width: 40px; }
    .task-label-title { padding: 0 6px; font-size: 10px; }
    .gantt-container {
        --row-height: 48px; --bar-height: 24px; --bar-top: 12px;
        --bar-font: 9px; --bar-pct: 7px; --label-font: 10px;
    }
    .gantt-zoom-bar {
        min-height: 38px;
        height: auto;
        padding: 5px 6px;
        gap: 3px;
        flex-wrap: wrap;
        row-gap: 5px;
    }
    .gantt-zoom-btn { width: 30px; height: 30px; }
    .gantt-zoom-settings-btn { width: 30px; height: 30px; }
    .gantt-zoom-fit-btn, .gantt-zoom-today-btn, .gantt-zoom-export-btn {
        min-width: 30px;
        min-height: 30px;
        padding: 5px 7px;
    }
    .gantt-view-switcher { gap: 1px; padding: 2px; }
    .gantt-view-btn { padding: 4px 7px; font-size: 10.5px; min-height: 26px; }
    .gantt-fab-add { width: 44px; height: 44px; right: 8px; }
    .gantt-fab-add svg { width: 28px; height: 28px; }
    .gantt-modal { top: auto; bottom: 0; left: 0; right: 0; transform: none; width: 100%; border-radius: 20px 20px 0 0; max-height: 90vh; overflow-y: auto; }
    .gantt-modal.show { transform: none; }
    .ai-modal-overlay { padding: 0; align-items: flex-end; }
    .ai-modal-box { max-width: 100%; max-height: 100vh; }
    .ai-modal-card { border-radius: 18px 18px 0 0; max-height: 100vh; }
    .ai-chat-messages { max-height: 55vh; }
    .plan-dropdown-menu { border-radius: 12px; padding: 4px; }
    .plan-menu-item { padding: 8px 10px; }
    #account-dropdown { min-width: 200px !important; }
    #collab-modal > div { border-radius: 18px; padding: 20px; }
    #account-modal > div { border-radius: 18px; margin: 12px; }
    .gantt-container.labels-collapsed .gantt-label-header,
    .gantt-container.labels-collapsed .task-label,
    .gantt-container.labels-collapsed .gantt-label-toggle-btn,
    .gantt-container.labels-collapsed .gantt-month-label-spacer { width: 44px !important; min-width: 44px !important; }
    .gantt-container.labels-collapsed .task-label-status { width: 44px !important; min-width: 44px !important; }
}

/* ── 5. LANDSCAPE SMARTPHONES (Höhe ≤ 500px) ─────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .app-layout {
        padding: calc(6px + var(--sa-top)) calc(10px + var(--sa-right))
                 calc(6px + var(--sa-bottom)) calc(10px + var(--sa-left));
        gap: 6px;
    }
    header.glass-card { padding: 6px 14px !important; }
    .logo { font-size: 16px; }
    .gantt-container {
        --row-height: 42px; --bar-height: 22px; --bar-top: 10px;
        --bar-font: 9px; --label-font: 10px;
    }
    .gantt-zoom-bar {
        min-height: 36px;
        height: auto;
        padding: 4px 8px;
        flex-wrap: wrap;
        row-gap: 4px;
    }
    .gantt-zoom-btn, .gantt-zoom-settings-btn { width: 28px; height: 28px; }
    .gantt-zoom-fit-btn, .gantt-zoom-today-btn, .gantt-zoom-export-btn {
        min-width: 28px;
        min-height: 28px;
        padding: 4px 7px;
    }
    .gantt-header { height: 40px; }
    .gantt-month-bar { height: 24px; }
    .month-cell { font-size: 9px; }
    .timeline-day-cell { font-size: 10px !important; }
    .gantt-modal, .ai-modal-card, .editor-card { max-height: 85vh; overflow-y: auto; }
    .ai-chat-messages { max-height: 35vh; min-height: 120px; }
    .gantt-fab-add { width: 40px; height: 40px; }
    .gantt-fab-add svg { width: 24px; height: 24px; }
}

/* ── 6. IPAD SPLIT-VIEW ──────────────────────────────────────── */
@media (min-width: 320px) and (max-width: 510px) and (min-height: 700px) {
    .gantt-label-header, .gantt-label-header-inner, .task-label,
    .gantt-label-toggle-btn, .gantt-month-label-spacer {
        width: 130px !important; min-width: 130px !important;
    }
    .task-label-title { padding: 0 8px; font-size: 10px; }
    .gantt-label-header-progress, .task-label-status { width: 44px; min-width: 44px; }
}

/* ═══════════════════════════════════════════════════════════════
   AUTH-OVERLAY — Landscape-Fix
   ═══════════════════════════════════════════════════════════════ */
.auth-overlay {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}
.auth-card {
    flex-shrink: 0;
    overflow: visible;
    max-height: none;
}
@media (max-width: 600px) {
    .auth-overlay { padding: 12px; }
    .auth-card { padding: 32px 24px !important; border-radius: 22px; max-width: 100%; }
    #auth-title { font-size: 24px; }
    #auth-subtitle { font-size: 13px; margin-bottom: 18px; }
    .glass-input { padding: 14px; font-size: 14px; margin-bottom: 12px; border-radius: 12px; }
    #auth-primary-btn { height: 48px; font-size: 14px; border-radius: 12px; }
    .auth-footer { margin-top: 18px; font-size: 13px; }
}
@media (max-width: 420px) {
    .auth-card { padding: 24px 18px !important; border-radius: 18px; }
    #auth-title { font-size: 22px; }
    .glass-input { padding: 12px; font-size: 13px; margin-bottom: 10px; }
    #auth-primary-btn { height: 44px; font-size: 13px; }
}

/* Landscape: alles stark komprimieren */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-overlay { padding: 6px 16px; align-items: flex-start; }
    .auth-card { padding: 14px 22px !important; border-radius: 14px; margin: 0 auto; }
    #auth-title { font-size: 17px; margin-bottom: 2px; }
    #auth-subtitle { font-size: 11px; margin-bottom: 6px; }
    .glass-input { padding: 7px 12px; font-size: 12px; margin-bottom: 5px; border-radius: 8px; }
    #auth-primary-btn { height: 34px; font-size: 12px; margin-top: 2px; border-radius: 8px; }
    .auth-footer { margin-top: 6px; font-size: 11px; }
    .auth-toggle-btn { height: 30px; font-size: 11px; border-radius: 8px; }
    .auth-close-btn { height: 26px; margin-top: 4px; font-size: 10px; border-radius: 6px; }
    .password-wrap { margin-bottom: 5px; }
    .g_id_signin { transform: scale(0.8); transform-origin: center; margin: -4px 0; }
    .auth-card > div[style*="margin:15px"] { margin: 4px 0 2px !important; font-size: 10px !important; }
    .success-toast, .error-toast {
        min-height: 30px; padding: 6px 12px; font-size: 11px;
        top: 8px; left: 8px; right: 8px; border-radius: 10px;
    }
}
@media (max-height: 380px) and (orientation: landscape) {
    .auth-overlay { padding: 4px 12px; }
    .auth-card { padding: 10px 18px !important; border-radius: 10px; }
    #auth-title { font-size: 15px; margin-bottom: 0; }
    #auth-subtitle { display: none; }
    .glass-input { padding: 6px 10px; margin-bottom: 3px; font-size: 11px; border-radius: 6px; }
    #auth-primary-btn { height: 28px; font-size: 11px; margin-top: 1px; }
    .auth-footer { margin-top: 3px; font-size: 9px; gap: 4px; }
    .auth-toggle-btn { height: 24px; font-size: 10px; }
    .auth-close-btn { height: 22px; margin-top: 2px; font-size: 9px; }
    .g_id_signin { transform: scale(0.7); margin: -6px 0; }
    .auth-card > div[style*="margin:15px"] { margin: 2px 0 1px !important; }
    .pw-toggle-btn svg { width: 16px; height: 16px; }
}

/* ── SAFE-AREA ───────────────────────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .app-layout { padding-bottom: calc(8px + env(safe-area-inset-bottom)); /*padding-left: calc(6px + env(safe-area-inset-left)); padding-right: calc(6px + env(safe-area-inset-right));*/ }
    .ai-modal-card { padding-bottom: env(safe-area-inset-bottom); }
    .gantt-modal { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
    .legal-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ── KEYBOARD ────────────────────────────────────────────────── */
@media (max-height: 400px) {
    .gantt-modal { padding: 16px; border-radius: 16px 16px 0 0; }
    .modal-group { margin-bottom: 10px; }
    .modal-footer { margin-top: 12px; }
    .ai-chat-messages { max-height: 25vh; min-height: 80px; }
}

/* ── PRINT ────────────────────────────────────────────────────── */
@media print {
    header.glass-card, .gantt-zoom-bar, .gantt-fab-add, .gantt-row-resizer,
    .legal-footer, .today-line-overlay { display: none !important; }
    .app-layout { padding: 0; }
    .gantt-container.glass-card { box-shadow: none; border: 1px solid #ccc; border-radius: 0; backdrop-filter: none; }
    body::before { display: none; }
    .task-label { background: white !important; color: black !important; }
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
@media (max-width: 820px) {
    .gantt-body::-webkit-scrollbar { height: 4px; }
    .gantt-body::-webkit-scrollbar-thumb { border-radius: 4px; }
}

/* ── REDUCED MOTION ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .gantt-body { scroll-behavior: auto; }
}