/*
Theme Name: Fotos
Theme URI: https://fotos.xxx
Author: Fotos Team
Description: TikTok-style vertical image feed.
Version: 2.0
License: GPL v2 or later
Text Domain: fotos
*/

/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ========== HEADER ========== */
.site-header {
  background: rgba(20, 20, 30, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #ff6b9d 0%, #c44dff 40%, #00E5FF 70%, #00ff88 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  text-decoration: none;
}

.language-switcher {
  position: relative;
  margin-left: 0.75rem;
  cursor: pointer;
}
.lang-current {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 30px;
  font-size: 0.75rem;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(20, 20, 30, 0.98);
  backdrop-filter: blur(15px);
  border-radius: 14px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
  min-width: 130px;
  max-height: 350px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  border: 1px solid rgba(255,255,255,0.1);
}
.language-switcher:hover .lang-dropdown {
  display: block;
}
.lang-dropdown a {
  display: block;
  padding: 8px 14px;
  text-decoration: none;
  color: #fff;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.lang-dropdown a:hover {
  background: rgba(255,255,255,0.1);
}
.lang-dropdown a.active {
  background: #00E5FF;
  color: #000;
}

.search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 0.5rem;
  color: #fff;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.search-toggle:hover {
  opacity: 1;
  color: #00E5FF;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  position: relative;
  margin-left: 0.5rem;
}
.hamburger,
.hamburger::before,
.hamburger::after {
  content: '';
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.25s ease;
  position: absolute;
  left: 6px;
}
.hamburger {
  top: 15px;
}
.hamburger::before {
  top: -6px;
}
.hamburger::after {
  bottom: -6px;
}
.menu-toggle.active .hamburger {
  background: transparent;
}
.menu-toggle.active .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}
.menu-toggle.active .hamburger::after {
  transform: rotate(-45deg);
  bottom: 0;
}

.main-nav {
  display: flex;
  align-items: center;
}
.primary-menu {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.primary-menu a {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.primary-menu a:hover {
  opacity: 1;
  color: #00E5FF;
}

@media (max-width: 768px) {
  .header-container {
    height: 44px;
    padding: 0 12px;
  }
  .logo-text {
    font-size: 1rem;
  }
  .menu-toggle {
    display: block;
  }
  .main-nav {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    max-width: 80%;
    height: 100vh;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: -2px 0 20px rgba(0,0,0,0.3);
    transition: right 0.3s ease;
    z-index: 1000;
    padding: 70px 1.5rem 2rem;
    overflow-y: auto;
    border-left: 1px solid rgba(255,255,255,0.1);
  }
  .main-nav.active {
    right: 0;
  }
  .primary-menu {
    flex-direction: column;
    gap: 1.2rem;
  }
  .primary-menu a {
    font-size: 1rem;
    display: block;
    padding: 0.4rem 0;
  }

  .language-switcher {
    margin-left: 0.25rem;
  }
  .lang-current .lang-code {
    display: none;
  }
  .lang-current {
    padding: 3px 5px;
  }
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
}
.menu-overlay.active {
  display: block;
}

/* ========== SEARCH OVERLAY ========== */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(12px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.search-overlay.active {
  display: flex;
}
.search-overlay-container {
  background: #1a1a2e;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  border-radius: 24px;
  padding: 1.5rem;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  color: #fff;
}
.search-overlay-container h2 {
  color: #fff;
  margin-bottom: 1.2rem;
  font-size: 1.4rem;
  font-weight: 600;
}
.close-overlay {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #fff;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.close-overlay:hover {
  opacity: 1;
}
.search-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem 0;
}
.search-fields input {
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 40px;
  font-size: 0.95rem;
  flex: 1;
  background: #2a2a3e;
  color: #fff;
}
.search-fields input::placeholder {
  color: #aaa;
}
.search-submit {
  padding: 0.8rem 1.5rem;
  background: #00E5FF;
  color: #000;
  border: none;
  border-radius: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.search-submit:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(0,229,255,0.3);
}

/* Grid de resultados de búsqueda */
.image-search-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.image-search-card {
  text-decoration: none;
  color: #fff;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
  position: relative;
}
.image-search-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}
.image-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #2a2a3e;
  overflow: hidden;
  border-radius: 10px;
}
.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  display: flex;
  justify-content: flex-start;
}
.image-likes {
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.no-results, .error {
  text-align: center;
  padding: 2rem;
  color: #fff;
  opacity: 0.7;
  font-size: 0.95rem;
}
.search-loading {
  text-align: center;
  padding: 2rem;
  color: #fff;
  opacity: 0.7;
}

/* Scroll personalizado */
.image-search-grid::-webkit-scrollbar {
  width: 4px;
}
.image-search-grid::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
  border-radius: 2px;
}
.image-search-grid::-webkit-scrollbar-thumb {
  background: #00E5FF;
  border-radius: 2px;
}

/* ========== FEED / REELS ========== */
.reels-container {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.reel {
  height: 100vh;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.reel-bg {
  display: none;
}
.image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.feed-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.swipe-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: pointer;
}

.video-info {
  position: absolute;
  left: 20px;
  right: 80px;
  bottom: 92px;
  z-index: 3;
  color: #fff;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
}
.video-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 5px;
}
.video-author {
  font-size: 14px;
  opacity: 0.85;
}
.video-meta {
  font-size: 14px;
  margin-top: 4px;
}

.actions {
  position: absolute;
  right: 10px;
  bottom: 116px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
  text-align: center;
  user-select: none;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.action-btn:active {
  transform: scale(0.95);
}
.action-btn span:first-child {
  font-size: 28px;
}

.loading-indicator {
  text-align: center;
  padding: 20px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  font-size: 14px;
}

/* ========== FILTROS ========== */
.filter-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #00E5FF;
  color: #000;
  border: none;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.filter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
}
.filter-overlay.active {
  display: flex;
}
.filter-container {
  background: #1e1e2f;
  border-radius: 24px;
  width: 90%;
  max-width: 400px;
  color: #fff;
  overflow: hidden;
}
.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #333;
}
.filter-header h3 { margin: 0; font-size: 1.2rem; }
.close-filter {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}
.filter-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-group label { font-size: 0.85rem; opacity: 0.8; }
.filter-group select {
  background: #2a2a3a;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 10px;
  color: #fff;
  font-size: 0.9rem;
}
.filter-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #333;
}
.apply-filters-btn, .reset-filters-btn {
  flex: 1;
  padding: 10px;
  border-radius: 40px;
  border: none;
  font-weight: bold;
  cursor: pointer;
}
.apply-filters-btn {
  background: #00E5FF;
  color: #000;
}
.reset-filters-btn {
  background: #3a3a4a;
  color: #fff;
}

/* ========== MENÚ MÓVIL INFERIOR ========== */
.mobile-menu {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
  background: rgba(20, 20, 30, 0.4);
  backdrop-filter: blur(12px);
  padding: 10px 24px;
  border-radius: 60px;
  z-index: 150;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: auto;
}
.menu-btn {
  background: rgba(0, 0, 0, 0.2);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.menu-btn:hover,
.menu-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
  .video-info {
    bottom: 98px;
    right: 72px;
  }
  .mobile-menu {
    gap: 16px;
    padding: 8px 20px;
    bottom: 16px;
    background: rgba(20, 20, 30, 0.35);
  }
  .menu-btn svg {
    width: 22px;
    height: 22px;
  }
  .search-overlay-container {
    padding: 1rem;
    width: 95%;
  }
  .search-fields input {
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
  }
  .search-submit {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
  }
  .image-search-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 600px) {
  .image-search-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}
@media (min-width: 900px) {
  .image-search-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ========== INDICADOR DE GALERÍA ========== */
.gallery-counter {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* ========== BOTÓN PLAY / PAUSE ========== */
.gallery-autoplay-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.gallery-autoplay-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}
.gallery-autoplay-btn svg {
    width: 18px;
    height: 18px;
}