/* ============================================
   MyTube Watch - Tema Verde e Preto Moderno
   ============================================ */

:root {
  --primary-green: #22c55e;
  --dark-green: #16a34a;
  --light-green: #4ade80;
  --bg-dark: #0a0a0a;
  --bg-card: #141414;
  --bg-input: #1a1a1a;
  --text-white: #ffffff;
  --text-gray: #a3a3a3;
  --border-color: #2a2a2a;
  --gradient-green: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --shadow-card: 0 4px 20px rgba(34, 197, 94, 0.15);
  --shadow-hover: 0 8px 30px rgba(34, 197, 94, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-dark);
  color: var(--text-white);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================
   Header Moderno
   ============================================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

header .logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

header .logo svg {
  color: var(--primary-green);
}

/* ============================================
   Busca com Lupa Lateral
   ============================================ */
.search-wrapper {
  display: flex;
  align-items: center;
}

.search-container {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 24px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.search-container:focus-within {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.search-container input {
  width: 240px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-white);
  font-size: 14px;
  outline: none;
}

.search-container input::placeholder {
  color: var(--text-gray);
}

.search-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.search-toggle:hover {
  color: var(--primary-green);
  background: rgba(34, 197, 94, 0.1);
}

/* ============================================
   Video Feed Grid Responsivo
   ============================================ */
.video-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 30px 40px;
  max-width: 1600px;
  margin: 0 auto;
}

.loading, .error, .no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-gray);
  font-size: 16px;
}

.error {
  color: #ef4444;
}

.error small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.8;
}

/* ============================================
   Video Card Moderno
   ============================================ */
.video-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
}

.video-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-green);
}

.video-card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover img {
  transform: scale(1.05);
}

.video-card .thumbnail-wrapper {
  position: relative;
  overflow: hidden;
}

.video-card h3 {
  padding: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Video Page - Player e Detalhes
   ============================================ */
.video-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 40px;
}

.video-container iframe {
  width: 100%;
  height: 560px;
  border-radius: 16px;
  border: none;
  box-shadow: var(--shadow-card);
}

.video-container h2 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 24px;
  color: var(--text-white);
  line-height: 1.3;
}

.video-container p {
  margin-top: 16px;
  color: var(--text-gray);
  font-size: 15px;
  line-height: 1.7;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

/* ============================================
   Seção Sugeridos
   ============================================ */
.suggested-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.suggested-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggested-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--gradient-green);
  border-radius: 2px;
}

.suggested-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ============================================
   Bottom Sheet Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  background: var(--bg-card);
  width: 100%;
  max-width: 800px;
  max-height: 70vh;
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.bottom-sheet-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
}

.close-modal {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-input);
  color: var(--text-white);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-modal:hover {
  background: var(--primary-green);
  color: white;
}

.bottom-sheet-content {
  padding: 24px;
  overflow-y: auto;
  color: var(--text-gray);
  font-size: 15px;
  line-height: 1.8;
}

.bottom-sheet-content a {
  color: var(--primary-green);
  text-decoration: none;
  word-break: break-all;
}

.bottom-sheet-content a:hover {
  text-decoration: underline;
}

.bottom-sheet-content .url-abbreviated {
  color: var(--light-green);
  cursor: pointer;
}

/* ============================================
   Responsividade
   ============================================ */
@media (max-width: 1024px) {
  header {
    padding: 12px 16px;
  }
  
  .video-feed {
    padding: 24px;
    gap: 20px;
  }
  
  .video-container {
    padding: 24px;
  }
  
  .video-container iframe {
    height: 450px;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }
  
  .search-container input {
    width: 180px;
  }
  
  .video-feed {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    padding: 16px;
    gap: 16px;
  }
  
  .video-container iframe {
    height: 300px;
  }
  
  .video-container h2 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  header .logo {
    font-size: 20px;
  }
  
  .search-container {
    width: 100%;
  }
  
  .search-container input {
    width: 100%;
  }
  
  .video-feed {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .video-card img {
    height: 180px;
  }
  
  .video-container iframe {
    height: 220px;
  }
  
  .video-container {
    padding: 16px;
  }
}

/* ============================================
   Animações e Efeitos
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.video-card {
  animation: fadeIn 0.4s ease forwards;
}

.video-card:nth-child(1) { animation-delay: 0.05s; }
.video-card:nth-child(2) { animation-delay: 0.1s; }
.video-card:nth-child(3) { animation-delay: 0.15s; }
.video-card:nth-child(4) { animation-delay: 0.2s; }
.video-card:nth-child(5) { animation-delay: 0.25s; }
.video-card:nth-child(6) { animation-delay: 0.3s; }
.video-card:nth-child(7) { animation-delay: 0.35s; }
.video-card:nth-child(8) { animation-delay: 0.4s; }
.video-card:nth-child(9) { animation-delay: 0.45s; }
.video-card:nth-child(10) { animation-delay: 0.5s; }
.video-card:nth-child(11) { animation-delay: 0.55s; }
.video-card:nth-child(12) { animation-delay: 0.6s; }

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-green);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 24px;
  text-align: center;
  width: 100%;
}

.footer p {
  color: var(--text-gray);
  font-size: 14px;
}
