/* === Responsive === */

/* Tablet */
@media (max-width: 1024px) {
  #app-screen {
    grid-template-columns: 220px 1fr;
  }

  .month-cell {
    min-height: 80px;
  }

  .month-kw-cell,
  .month-kw-head {
    display: none;
  }

  .month-weekdays {
    grid-template-columns: repeat(7, 1fr);
  }

  .month-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .year-view {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    padding: 16px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex;
  }

  #app-screen {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    max-width: 85vw;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 499;
    animation: fadeIn 180ms ease;
  }

  .toolbar {
    padding: 10px 12px;
    gap: 4px;
    flex-wrap: wrap;
    min-height: auto;
  }

  .period-label {
    font-size: 15px;
    margin: 0 4px;
    flex: 1 0 100%;
    order: -1;
    text-align: center;
    padding: 6px 0;
  }

  .month-cell {
    min-height: 60px;
    padding: 4px;
  }

  .month-cell-date {
    font-size: 11px;
    padding: 1px 4px;
  }

  .event-pill {
    font-size: 10px;
    padding: 1px 4px;
  }

  .month-weekday {
    padding: 6px 4px;
    font-size: 10px;
  }

  .view-buttons .view-btn {
    padding: 4px 7px;
    font-size: 11px;
  }

  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    animation: slideUpMobile 220ms ease;
  }

  @keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .auth-card {
    margin: 20px;
    padding: 24px;
  }

  .toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }

  .timegrid-day-header {
    padding: 4px;
    font-size: 11px;
  }

  .timegrid-day-header .day-number {
    font-size: 16px;
  }

  .timegrid-hour {
    height: 40px;
    font-size: 9px;
  }

  .timegrid-col-hour {
    height: 40px;
  }

  .agenda-time {
    width: 80px;
    font-size: 11px;
  }

  .agenda-view {
    padding: 12px;
  }

  .agenda-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .agenda-controls-actions {
    justify-content: stretch;
  }

  .agenda-month-input {
    flex: 1;
    min-width: 0;
  }

  .agenda-today-btn {
    flex: 1;
  }

  .year-view {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }
}

/* Sehr klein */
@media (max-width: 380px) {
  .month-cell {
    min-height: 50px;
  }

  .month-cell-events {
    display: none;
  }

  .month-cell.has-events::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
  }

  .toolbar .btn {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* Safe-Area für Notch */
@supports (padding: max(0px)) {
  .sidebar {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .toolbar {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}
