/* panel-movil.css: the dashboard on tablets and phones (768 px and less).
   Loaded right after the file before it; the order of every panel file is in
   panel-login.css. */

/* Responsive Dashboard Styles */

@media (max-width: 768px) {
  #admin-dashboard {
    flex-direction: column;
  }
  
  .dashboard-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
  }
  
  .sidebar-brand {
    padding: 12px 0 12px 16px;
    align-items: flex-start;
    border-bottom: none;
  }
  
  /* The sections become a bar at the bottom of the screen
     (public/barra-movil.js): four tabs and "Más", which unfolds the rest
     above it as a list. */
  .sidebar-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(9, 10, 15, 0.97);
    border-top: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .menu-item {
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 6px 2px;
    border-radius: 10px;
    font-size: 0.68rem;
  }

  .menu-item svg {
    width: 28px;
    height: 28px;
    padding: 5px;
  }

  /* In the bar each button shows its short name; the full one still names
     it for screen readers. */
  .menu-item > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .menu-item[data-short]::after {
    content: attr(data-short);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-item.mobile-only {
    display: flex;
  }

  .menu-item.menu-in-more {
    display: none;
  }

  .sidebar-menu.more-open .menu-item.menu-in-more:not(.hidden) {
    display: flex;
    order: -1;
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 14px;
    padding: 12px 14px;
    font-size: 0.92rem;
  }

  .sidebar-menu.more-open .menu-in-more > span {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }

  .sidebar-menu.more-open .menu-in-more::after {
    content: none;
  }

  .sidebar-menu.more-open {
    padding-top: 10px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
  }

  /* Room for the bar under the last setting. The notices are lifted above
     the bar in panel-ayudas.css, after their own rule. */
  .dashboard-body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  /* Brand and search share the top row. No backdrop-filter here: it would
     make the sidebar the containing block of the fixed bottom bar. */
  .dashboard-sidebar {
    position: relative;
    z-index: 30;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(9, 10, 15, 0.95);
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0 16px 0 0;
  }

  .sidebar-search {
    flex: 1;
    margin: 0;
  }

  .menu-group-label,
  .dashboard-subtitle {
    display: none;
  }
  
  .sidebar-footer {
    display: none;
  }
  
  /* The header is one low row: the tab's name, then icon buttons for the
     preview and "Ver mi bio" and the save button. Their names stay for
     screen readers. */
  .dashboard-header {
    gap: 10px;
    padding: 8px 16px;
  }

  .dashboard-heading {
    flex: 1;
  }

  .dashboard-header h1 {
    overflow: hidden;
    font-size: 1.05rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .header-actions {
    flex-shrink: 0;
    gap: 8px;
  }

  .header-actions > .action-btn {
    height: 38px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .header-actions > .preview-toggle-btn,
  .header-actions > .view-bio-btn {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .view-bio-btn svg {
    display: block;
  }

  .header-btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  
  .dashboard-body {
    padding: 20px;
  }
}

/* On a touch screen the small buttons keep their size and get a 44 px touch
   area: an invisible ::after around each one. None of them sets a position or
   uses ::after for anything else. */
@media (pointer: coarse) {
  .info-tip-btn,
  .card-delete-btn,
  .card-move-btn,
  .switch-extra-btn,
  .color-eyedropper,
  .contrast-wand,
  .home-copy-btn,
  .home-card-icon-btn,
  .home-more-btn,
  .collapsible-header,
  .stats-range-btn,
  .gradient-dir-btn,
  .badge-card-icon-btn,
  .card-edit-btn,
  .toast-close {
    position: relative;
  }

  .info-tip-btn::after,
  .card-delete-btn::after,
  .card-move-btn::after,
  .switch-extra-btn::after,
  .color-eyedropper::after,
  .contrast-wand::after,
  .home-copy-btn::after,
  .home-card-icon-btn::after,
  .home-more-btn::after,
  .collapsible-header::after,
  .stats-range-btn::after,
  .gradient-dir-btn::after,
  .badge-card-icon-btn::after,
  .card-edit-btn::after,
  .toast-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    min-width: 44px;
    min-height: 44px;
    transform: translate(-50%, -50%);
  }
}
