/* ============================================================
   MOBILE UI — Sync2Stage
   Área autenticada, mobile-first
   ============================================================ */

/* =================== BOTTOM TAB BAR =================== */
.mobile-bottom-nav {
  display: flex;
  align-items: stretch;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #1a1a1a;
  border-top: 1px solid #333;
  z-index: 2000;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-bottom-nav.nav-stage-hidden {
  display: none !important;
}

.mobile-bottom-nav.nav-stage-visible {
  display: flex !important;
  align-items: stretch;
}

.mobile-nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #888;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color 0.2s ease;
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  padding: 4px 2px;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-tab i {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.mobile-nav-tab span {
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.mobile-nav-tab.active,
.mobile-nav-tab:active {
  color: #f59e0b;
}

.mobile-nav-stage {
  color: #f59e0b !important;
}

.mobile-nav-live-badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 22px);
  background: #10b981;
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  line-height: 1.4;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}

/* =================== MORE DRAWER =================== */
.mobile-more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2001;
  cursor: pointer;
}

.mobile-more-overlay.open {
  display: block;
}

.mobile-more-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2002;
  background: #1e1e1e;
  border-radius: 16px 16px 0 0;
  border-top: 1px solid #444;
  padding: 12px 0;
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: block;
}

.mobile-more-drawer {
  display: block;
}

.mobile-more-drawer.open {
  transform: translateY(0);
}

.mobile-more-drawer .drawer-handle {
  width: 40px;
  height: 4px;
  background: #555;
  border-radius: 2px;
  margin: 0 auto 12px;
}

.mobile-drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  min-height: 52px;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-item i {
  width: 22px;
  text-align: center;
  font-size: 16px;
  color: #9ca3af;
  flex-shrink: 0;
}

.mobile-drawer-item:hover,
.mobile-drawer-item:active {
  background: rgba(255, 255, 255, 0.07);
  color: #f59e0b;
}

.mobile-drawer-item:hover i,
.mobile-drawer-item:active i {
  color: #f59e0b;
}

/* =================== BOTTOM ACTION BAR (STAGE) =================== */
.mobile-action-bar {
  display: none;
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(20, 20, 20, 0.92) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1024px) {
  .mobile-action-bar {
    display: flex;
  }
}

.mobile-bar-btn {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: #999;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bar-btn i {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.mobile-bar-btn span {
  font-size: 10px;
  pointer-events: none;
}

.mobile-bar-btn:active {
  color: #fff;
}

/* Prev/Next hidden until playlist loaded */
.mobile-bar-btn.mobile-bar-prev,
.mobile-bar-btn.mobile-bar-next {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, color 0.2s ease;
}

.mobile-action-bar.playlist-loaded .mobile-bar-prev,
.mobile-action-bar.playlist-loaded .mobile-bar-next {
  opacity: 1;
  pointer-events: auto;
}

/* Central play/pause button */
.mobile-bar-playpause {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: #FEC70E;
  color: #000 !important;
  font-size: 20px !important;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.4);
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  gap: 0 !important;
}

.mobile-bar-playpause:active {
  transform: scale(0.92);
}

.mobile-bar-playpause.playing {
  background: #10b981;
  animation: mobilePlayPulse 2s ease-in-out infinite;
}

.mobile-bar-playpause.paused {
  background: #FEC70E;
}

@keyframes mobilePlayPulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 2px 24px rgba(16, 185, 129, 0.7); }
}

/* =================== SPEED CONTROLS =================== */
.mobile-speed-controls {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1150;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: none;
}

@media (max-width: 1024px) {
  .mobile-speed-controls {
    display: flex;
  }

  .mobile-speed-controls.visible {
    opacity: 1;
    pointer-events: auto;
  }
}

.mobile-speed-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-speed-btn:active {
  transform: scale(0.9);
  background: rgba(245, 158, 11, 0.4);
  border-color: #f59e0b;
}

/* =================== SEARCH BOTTOM SHEET =================== */
.sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1399;
  touch-action: none;
}

.sheet-overlay.open {
  display: block;
}

.mobile-search-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1400;
  background: #1e1e1e;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid #444;
  height: 60vh;
  min-height: 300px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: none;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 1024px) {
  .mobile-search-sheet {
    display: flex;
  }
}

.mobile-search-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: #555;
  border-radius: 2px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}

.sheet-header {
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.sheet-search-input {
  width: 100% !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  color: #f1f5f9 !important;
  font-size: 16px !important;
  outline: none !important;
  transition: border-color 0.2s !important;
  box-shadow: none !important;
}

.sheet-search-input:focus {
  border-color: #f59e0b !important;
  background: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2) !important;
  color: #ffffff !important;
}

.sheet-search-input::placeholder {
  color: rgba(255, 255, 255, 0.35) !important;
}

.sheet-results {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
  -webkit-overflow-scrolling: touch;
}

.sheet-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  min-height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.sheet-result-item:active {
  background: rgba(245, 158, 11, 0.08);
}

/* Send-to-stage button */
.sheet-result-load {
  flex-shrink: 0 !important;
  align-self: center !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  background: rgba(245, 158, 11, 0.08) !important;
  color: #f59e0b !important;
  font-size: 0.55rem !important;
  line-height: 1 !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.sheet-result-load:active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  transform: scale(0.9);
}

.sheet-result-open {
  flex-shrink: 0 !important;
  align-self: center !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
  font-size: 0.6rem !important;
  line-height: 1 !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  -webkit-tap-highlight-color: transparent;
}

.sheet-result-open:active,
.sheet-result-open:hover {
  color: #ffffff !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  background: rgba(245, 158, 11, 0.16) !important;
}

.sheet-result-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 158, 11, 0.45);
  font-size: 11px;
  flex-shrink: 0;
}

.sheet-result-info {
  flex: 1;
  min-width: 0;
}

.sheet-result-title {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-result-artist {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-empty {
  text-align: center;
  padding: 32px 16px;
  color: #6b7280;
  font-size: 14px;
}

.sheet-loading {
  text-align: center;
  padding: 24px;
  color: #9ca3af;
  font-size: 14px;
}

/* =================== PAGE HEADER COMPONENT =================== */
.page-header-wrapper {
  background: #ffffff;
  border-bottom: 1px solid #dee2e6;
  position: relative;
  z-index: 10;
}

.page-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
}

.page-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #212529;
}

.page-header-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.page-header-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #212529;
  line-height: 1.2;
}

.page-header-subtitle {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 400;
  margin-top: 1px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* =================== MOBILE OVERRIDES — AUTHENTICATED AREA =================== */
@media (max-width: 1024px) {

  /* Hide FAB — replaced by bottom tab bar */
  .fab-menu-container {
    display: none !important;
  }

  /* Padding bottom for all pages except stage (stage uses action bar CSS in admin.html.twig) */
  .main-panel.full-width .container {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Page header compact */
  .page-header-content {
    padding: 0.5rem 0;
  }

  .page-header-title {
    font-size: 1.05rem;
  }

  .page-header-subtitle {
    font-size: 0.74rem;
  }

  .page-header-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.85rem;
  }

  /* Safe area for content */
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .page-header-actions .btn,
  .page-header-actions a.btn {
    min-height: 36px !important;
    padding: 0.4rem 0.75rem !important;
  }
}

@media (max-width: 768px) {
  .page-header-content {
    padding: 0.4rem 0;
  }

  .page-header-subtitle {
    display: none;
  }

  .page-header-icon {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .page-header-title {
    font-size: 1rem;
  }

  .page-header-actions .btn,
  .page-header-actions a.btn {
    min-height: 34px !important;
    padding: 0.35rem 0.65rem !important;
    font-size: 0.85rem !important;
  }
}

@media (max-width: 576px) {
  .page-header-content {
    padding: 0.35rem 0;
  }

  .page-header-title {
    font-size: 0.95rem;
  }
}
