/**
 * TASKMATE - Mobile Styles
 * ========================
 * Touch-optimierte Mobile-Erfahrung
 * Nur auf mobilen Breakpoints angewendet
 */

/* ========================================
   DESKTOP: Mobile-Elemente verstecken
   ======================================== */

@media (min-width: 769px) {
  .hamburger-btn,
  .mobile-menu,
  .mobile-menu-overlay,
  .swipe-indicator {
    display: none !important;
  }
}

/* ========================================
   MOBILE STYLES (max-width: 768px)
   ======================================== */

@media (max-width: 768px) {

  /* ========================================
     HAMBURGER BUTTON
     ======================================== */

  .hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: calc(var(--z-modal) + 10);
    position: relative;
    flex-shrink: 0;
  }

  .hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  .hamburger-line + .hamburger-line {
    margin-top: 6px;
  }

  /* Hamburger zu X Animation */
  .hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* ========================================
     MOBILE COLUMN INDICATOR
     ======================================== */
  
  .mobile-column-indicator {
    position: fixed;
    bottom: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    text-align: center;
    pointer-events: none;
  }

  .column-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
  }

  .column-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    opacity: 0.3;
    transition: all 0.3s ease;
  }

  .column-dots .dot.active {
    background: var(--primary);
    opacity: 1;
    transform: scale(1.2);
  }

  .column-name {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  /* Mobile view hint */
  .mobile-view-hint {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
  }

  .mobile-view-hint.visible {
    opacity: 1;
  }

  .mobile-view-hint.left {
    left: 20px;
  }

  .mobile-view-hint.right {
    right: 20px;
  }

  /* ========================================
     MOBILE SLIDE-IN MENU
     ======================================== */

  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  .mobile-menu.open {
    transform: translateX(0);
  }

  /* Overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    opacity: 0;
    visibility: hidden;
    z-index: calc(var(--z-modal) - 1);
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
  }

  /* Menu Header */
  .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
  }

  .mobile-menu-title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--primary);
    margin: 0;
  }

  .mobile-menu-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    font-size: 1.5rem;
  }

  .mobile-menu-close:hover,
  .mobile-menu-close:active {
    background: var(--bg-hover);
  }

  /* Menu Sections */
  .mobile-menu-section {
    padding: var(--spacing-4);
    border-bottom: 1px solid var(--border-light);
  }

  .mobile-menu-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-2);
  }

  /* Project Select */
  .mobile-project-select {
    width: 100%;
    padding: var(--spacing-3);
    font-size: var(--text-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-primary);
  }

  /* Navigation */
  .mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
  }

  .mobile-nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
  }

  .mobile-nav-item:hover,
  .mobile-nav-item:active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
  }

  .mobile-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
  }

  .mobile-nav-item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
  }

  /* User Section */
  .mobile-menu-user {
    margin-top: auto;
    padding: var(--spacing-4);
    border-top: 1px solid var(--border-light);
  }

  .mobile-user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
  }

  .mobile-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    flex-shrink: 0;
  }

  .mobile-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .mobile-user-name {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-user-role {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
  }

  .mobile-menu-btn {
    width: 100%;
    padding: var(--spacing-3);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: var(--spacing-2);
    transition: background 0.2s;
  }

  .mobile-menu-btn:hover,
  .mobile-menu-btn:active {
    background: var(--bg-hover);
  }

  .mobile-menu-btn-danger {
    color: var(--error);
  }

  .mobile-menu-btn-danger:hover,
  .mobile-menu-btn-danger:active {
    background: var(--error-bg);
  }

  /* ========================================
     HEADER ANPASSUNGEN
     ======================================== */

  /* Desktop-Navigation verstecken */
  .header-center .view-tabs {
    display: none !important;
  }

  .header-left .project-selector {
    display: none !important;
  }

  /* Header Layout anpassen */
  .header-left {
    gap: var(--spacing-2);
  }

  /* ========================================
     TOUCH DRAG & DROP FEEDBACK
     ======================================== */

  .task-card.touch-dragging {
    transform: scale(1.03);
    box-shadow: var(--shadow-xl);
    opacity: 0.95;
    z-index: 1000;
    transition: none;
    pointer-events: none;
  }

  .task-card.touch-drag-placeholder {
    opacity: 0.3;
    border: 2px dashed var(--border-default);
  }

  .column-body.touch-drag-over {
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
  }

  /* ========================================
     SWIPE INDIKATOREN
     ======================================== */

  .swipe-indicator {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-bg);
    color: var(--text-inverse);
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
  }

  .swipe-indicator.left {
    left: 0;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  }

  .swipe-indicator.right {
    right: 0;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  }

  .swipe-indicator.visible {
    opacity: 0.7;
  }

  .swipe-indicator svg {
    width: 24px;
    height: 24px;
  }

  /* ========================================
     BOARD VIEW - HORIZONTAL SCROLLING
     ======================================== */

  .view-board .board {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .view-board .column {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* ========================================
     PREVENT TEXT SELECTION DURING GESTURES
     ======================================== */

  .is-swiping,
  .is-swiping *,
  .is-touch-dragging,
  .is-touch-dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
  }

  /* ========================================
     BODY SCROLL LOCK
     ======================================== */

  body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* ========================================
     TOUCH-FREUNDLICHE ELEMENTE
     ======================================== */

  /* Groessere Touch-Targets */
  .calendar-day {
    min-height: 70px;
    touch-action: manipulation;
  }

  /* Task-Karten */
  .task-card {
    touch-action: pan-y;
  }

  /* Buttons */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* ========================================
     MOBILE BOARD OPTIMIERUNG
     ======================================== */

  /* Task Cards - Groesser und besser lesbar */
  .task-card {
    padding: var(--spacing-4);
    border-radius: var(--radius-xl);
  }

  .task-title {
    font-size: 1rem;
    line-height: 1.4;
    font-weight: var(--font-semibold);
  }

  .task-card-meta {
    font-size: var(--text-sm);
    gap: var(--spacing-4);
    margin-top: var(--spacing-4);
  }

  .task-meta-item {
    gap: 6px;
  }

  .task-meta-item .icon {
    width: 18px;
    height: 18px;
  }

  .task-card-labels {
    gap: 8px;
    margin-top: var(--spacing-4);
  }

  .task-label {
    padding: 6px 12px;
    font-size: var(--text-sm);
  }

  .task-card-footer {
    margin-top: var(--spacing-4);
    padding-top: var(--spacing-4);
  }

  .task-assignee-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .task-counts {
    font-size: var(--text-sm);
    gap: var(--spacing-4);
  }

  /* Priority Stars groesser */
  .priority-stars {
    font-size: 16px;
  }

  /* Column Header */
  .column-header {
    padding: var(--spacing-4);
  }

  .column-title {
    font-size: var(--text-base);
  }

  .column-count {
    min-width: 28px;
    height: 28px;
    font-size: var(--text-sm);
  }

  /* Column Body */
  .column-body {
    padding: var(--spacing-3);
    gap: var(--spacing-3);
  }

  /* Add Task Button */
  .btn-add-task {
    padding: var(--spacing-4);
    font-size: var(--text-base);
    min-height: 52px;
  }

  /* Filter Bar */
  .filter-bar {
    padding: var(--spacing-4);
    gap: var(--spacing-3);
  }

  .filter-select {
    min-height: 44px;
    font-size: var(--text-base);
    padding: var(--spacing-3) var(--spacing-4);
  }

  /* Stats Bar */
  .board-stats-bar {
    padding: var(--spacing-3) var(--spacing-4);
    gap: var(--spacing-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .board-stat {
    flex-shrink: 0;
  }

  .board-stat-icon {
    width: 36px;
    height: 36px;
  }

  .board-stat-icon svg {
    width: 20px;
    height: 20px;
  }

  .board-stat-value {
    font-size: var(--text-lg);
  }

  .board-stat-label {
    font-size: var(--text-sm);
  }

  /* Week Strip */
  .week-strip {
    padding: var(--spacing-3) var(--spacing-4);
  }

  .week-strip-nav {
    width: 40px;
    height: 40px;
  }

  .week-strip-nav svg {
    width: 20px;
    height: 20px;
  }

  .week-strip-day {
    padding: var(--spacing-2) var(--spacing-3);
  }

  .week-strip-day-name {
    font-size: 12px;
  }

  .week-strip-day-number {
    font-size: var(--text-lg);
  }

  .week-strip-today {
    font-size: var(--text-sm);
    padding: var(--spacing-2) var(--spacing-3);
    min-height: 40px;
  }

  /* Board Padding */
  .board {
    padding: var(--spacing-3);
    gap: var(--spacing-3);
  }

  /* Modal auf Mobile */
  .modal-body {
    padding: var(--spacing-5);
  }

  .form-group label {
    font-size: var(--text-base);
    margin-bottom: var(--spacing-3);
  }

  /* Subtasks groesser */
  .subtask-item {
    padding: var(--spacing-3) var(--spacing-4);
    min-height: 48px;
  }

  .subtask-title {
    font-size: var(--text-base);
  }

  /* Comments groesser */
  .comment-content {
    padding: var(--spacing-4);
  }

  .comment-text {
    font-size: var(--text-base);
    line-height: 1.6;
  }

  /* Attachments */
  .attachment-name {
    font-size: var(--text-base);
  }

  /* Links */
  .link-item {
    padding: var(--spacing-4);
  }

  .link-title {
    font-size: var(--text-base);
  }
}

/* ========================================
   EXTRA SMALL MOBILE (max 480px)
   ======================================== */

@media (max-width: 480px) {
  .mobile-menu {
    width: 100%;
    max-width: 100%;
  }

  .hamburger-btn {
    width: 40px;
    height: 40px;
    padding: 8px;
  }

  .hamburger-line {
    width: 20px;
  }

  .hamburger-line + .hamburger-line {
    margin-top: 5px;
  }

  .hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ========================================
     EXTRA SMALL: NOCH GROESSERE ELEMENTE
     ======================================== */

  /* Task Cards noch groesser */
  .task-card {
    padding: var(--spacing-5);
  }

  .task-title {
    font-size: 1.125rem;
    line-height: 1.5;
  }

  .task-card-meta {
    font-size: var(--text-base);
  }

  .task-label {
    padding: 8px 14px;
    font-size: var(--text-base);
  }

  /* Column */
  .column-header {
    padding: var(--spacing-4) var(--spacing-5);
  }

  .column-title {
    font-size: var(--text-lg);
  }

  .column-body {
    padding: var(--spacing-4);
    gap: var(--spacing-4);
  }

  /* Filter - vertikal auf sehr kleinen Screens */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-3);
  }

  .filter-group label {
    display: none;
  }

  .filter-select {
    width: 100%;
    min-height: 48px;
  }

  .filter-actions {
    margin-left: 0;
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Stats Bar - scrollbar horizontal */
  .board-stats-bar {
    justify-content: flex-start;
    gap: var(--spacing-5);
    padding: var(--spacing-4);
  }

  .board-stat-icon {
    width: 40px;
    height: 40px;
  }

  .board-stat-value {
    font-size: var(--text-xl);
  }

  /* Week Strip kompakter */
  .week-strip {
    padding: var(--spacing-2) var(--spacing-3);
  }

  .week-strip-day {
    padding: var(--spacing-2);
  }

  .week-strip-day-name {
    font-size: 11px;
  }

  .week-strip-day-number {
    font-size: var(--text-base);
  }

  /* Login Screen */
  .login-container {
    padding: var(--spacing-6);
  }

  .login-header h1 {
    font-size: var(--text-xl);
  }

  .login-form .form-group label {
    font-size: var(--text-base);
  }

  /* Modals */
  .modal {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .modal-header {
    padding: var(--spacing-4);
  }

  .modal-header h2 {
    font-size: var(--text-lg);
  }

  .modal-body {
    padding: var(--spacing-4);
  }

  .modal-footer {
    padding: var(--spacing-4);
  }

  /* Form Groups */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Add Task Button */
  .btn-add-task {
    min-height: 56px;
    font-size: var(--text-lg);
  }
}
