/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #ffffff;
  color: #1e3a8a;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px 0;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(30, 58, 138, 0.2);
}

header h1 {
  font-size: 2.5rem;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  font-weight: 700;
}

/* Player Container */
.player-container {
  background: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: 0 8px 30px rgba(30, 58, 138, 0.15);
  border: 2px solid #e5e7eb;
  animation: slideDown 0.4s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
}

.player-title {
  font-size: 1.3rem;
  font-weight: 600;
}

.player-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.copy-btn i {
  font-size: 1rem;
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  background: #000;
}

#streamFrame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.close-circle-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(30, 58, 138, 0.9);
  border: 2px solid white;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.close-circle-btn:hover {
  background: #dc2626;
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

/* Search Bar */
.search-container {
  position: relative;
  margin-bottom: 30px;
  max-width: 600px;
  margin: 0 auto 40px;
}

#searchInput {
  width: 100%;
  padding: 18px 25px 18px 55px;
  border: 2px solid #e5e7eb;
  border-radius: 50px;
  font-size: 1rem;
  background: #f9fafb;
  color: #1e3a8a;
  outline: none;
  transition: all 0.3s ease;
}

#searchInput:focus {
  background: #ffffff;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.1);
}

#searchInput::placeholder {
  color: #9ca3af;
}

.search-container i {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: #1e3a8a;
  font-size: 1.1rem;
}

/* Channels Grid */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 25px;
  padding: 10px;
}

.channel-card {
  background: #ffffff;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.channel-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(30, 58, 138, 0.15);
  border-color: #1e3a8a;
}

.channel-logo {
  width: 100%;
  padding-top: 75%;
  position: relative;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.channel-logo::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.channel-card:hover .channel-logo::before {
  opacity: 1;
}

.channel-logo img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.channel-card:hover .channel-logo img {
  transform: translate(-50%, -50%) scale(1.1);
}

.channel-name {
  padding: 18px 15px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e3a8a;
  background: linear-gradient(to bottom, #f9fafb 0%, #ffffff 100%);
  border-top: 2px solid #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loading,
.error,
.no-results {
  text-align: center;
  padding: 50px;
  grid-column: 1 / -1;
  font-size: 1.2rem;
  background: #f0f9ff;
  border-radius: 15px;
  margin: 20px 0;
  border: 2px dashed #3b82f6;
  color: #1e3a8a;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid #1e3a8a;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  color: #dc2626;
  background: #fef2f2;
  border-color: #dc2626;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #1e3a8a;
  color: white;
  padding: 15px 25px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 2000;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast i {
  font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  header h1 {
    font-size: 2rem;
  }

  .player-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .player-controls {
    width: 100%;
  }

  .copy-btn {
    width: 100%;
    justify-content: center;
  }

  .close-circle-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  .channel-name {
    font-size: 0.85rem;
    padding: 12px 8px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .player-title {
    font-size: 1rem;
  }

  .copy-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .close-circle-btn {
    width: 35px;
    height: 35px;
    top: 10px;
    right: 10px;
  }
}
