/* Galeria — interface estilo app */
.galeria-page {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(20, 20, 20, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  z-index: 20;
}

.app-header-title {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.app-header-title h1 {
  font-size: 1.05rem;
  font-weight: 700;
}

.app-header-title p {
  font-size: 0.72rem;
  color: #888;
  margin-top: 2px;
}

.btn-nav {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-nav:active {
  opacity: 0.8;
}

.btn-icon {
  width: 42px;
  padding: 10px;
  font-size: 1.2rem;
}

.gallery-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.gallery-state {
  text-align: center;
  padding: 48px 24px;
  color: #aaa;
  font-size: 0.95rem;
}

.gallery-state .btn {
  margin-top: 20px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(145deg, #333, #222);
  position: relative;
}

.empty-icon::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 3px solid #555;
  border-radius: 6px;
}

.video-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.video-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.video-thumb-wrap {
  position: relative;
  background: #111;
  aspect-ratio: 16 / 9;
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 2.5rem;
}

.video-card-body {
  padding: 12px 14px 14px;
}

.video-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.video-card-meta strong {
  font-size: 0.88rem;
  display: block;
  word-break: break-all;
}

.video-card-meta span {
  font-size: 0.75rem;
  color: #888;
  white-space: nowrap;
}

.video-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.video-card-actions .btn {
  padding: 10px 8px;
  font-size: 0.78rem;
  min-width: 0;
}

.btn-danger {
  background: rgba(255, 59, 48, 0.2);
  color: #ff6b6b;
  border: 1px solid rgba(255, 59, 48, 0.35);
}

.btn-danger:active {
  background: rgba(255, 59, 48, 0.35);
}

/* Modal player */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.player-modal-inner {
  width: min(100%, 420px);
  position: relative;
}

.btn-close-player {
  position: absolute;
  top: -8px;
  right: 0;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

#player-video {
  width: 100%;
  border-radius: 12px;
  background: #000;
}

.player-title {
  font-size: 0.82rem;
  color: #aaa;
  margin: 10px 0;
  word-break: break-all;
}

.player-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-actions .btn {
  text-align: center;
  text-decoration: none;
}

/* Botão galeria na câmera */
.btn-gallery-link {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 15;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.btn-gallery-link:active {
  opacity: 0.85;
}

.btn-gallery-secondary {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  display: inline-block;
  padding: 14px 24px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
}

a.disabled,
a[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.video-card-invalid {
  opacity: 0.85;
}

.video-invalid-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(220, 53, 69, 0.9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.video-thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #888;
  font-size: 0.75rem;
}
