@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  
  header {
    padding: 10px 16px;
    gap: 12px;
  }
  
  .search-wrap {
    flex: 1;
    max-width: none;
  }
  
  #searchInput {
    font-size: 16px;
    padding: 10px 14px;
    max-width: none;
  }
  
  .admin-banner {
    padding: 12px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .admin-banner .banner-actions {
    justify-content: stretch;
  }
  
  .admin-banner button {
    flex: 1;
    padding: 10px;
  }
  
  .layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    max-height: calc(100vh - 120px);
    border-right: none;
    border-top: 1px solid #3f3f3f;
    z-index: 45;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateY(0);
  }
  
  .sidebar.open .sidebar-close-arrow {
    display: flex;
  }
  
  .sidebar-content {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-top: 52px;
    -webkit-overflow-scrolling: touch;
  }
  
  .mobile-filter-toggle {
    display: flex;
  }
  
  .mobile-grid-controls {
    display: none !important;
  }
  
  main {
    padding: 16px;
    padding-bottom: 80px;
  }
  
  .grid {
    gap: 16px;
  }
  
  .cell .meta .name {
    font-size: 15px;
  }
  
  .cell .meta .sub {
    font-size: 11px;
  }
  
  .detail {
    gap: 16px;
  }
  
  .detail .info {
    padding: 16px;
  }
  
  .detail .info h2 {
    font-size: 20px;
  }
  
  .detail .info .actions {
    flex-direction: column;
  }
  
  .detail .info .actions button {
    width: 100%;
  }
  
  .nav-arrows-container {
    flex-direction: column;
  }
  
  .nav-arrow-btn {
    width: 100%;
  }
  
  .gallery {
    gap: 12px;
  }
  
  .gallery.single-media .item {
    height: calc(100vh - 250px);
    min-height: 400px;
  }
  
  .gallery .item .item-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .gallery .item .item-bar .filename {
    white-space: normal;
    word-break: break-all;
  }
  
  .gallery .item .item-bar button {
    width: 100%;
    padding: 10px;
  }
  
  .item-bar-buttons {
    width: 100%;
    flex-direction: column;
  }
  
  .item-bar-buttons button {
    width: 100%;
  }
  
  .toast {
    bottom: 80px;
  }
  
  /* Edit mode mobile */
  .detail.edit-mode {
    grid-template-columns: 1fr;
  }
  
  .edit-info {
    max-height: none;
  }
  
  .edit-media-card {
    flex-direction: column;
  }
  
  .edit-media-preview {
    width: 100%;
    height: 200px;
  }
  
  .edit-media-info button {
    width: 100%;
  }
  
  .fullscreen-close {
    top: 10px;
    left: 10px;
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .fullscreen-content {
    padding: 60px 10px 10px;
  }
}

@media (max-width: 480px) {
  #searchInput {
    font-size: 16px;
    padding: 9px 12px;
  }
  
  main {
    padding: 12px;
    padding-bottom: 80px;
  }
  
  .detail .info h2 {
    font-size: 18px;
  }
  
  .edit-media-preview {
    height: 150px;
  }
  
  .gallery.single-media .item {
    height: calc(100vh - 280px);
    min-height: 300px;
  }
}
