@import url('https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap');

/* ====================== STYLES GLOBAUX ====================== */
body {
  font-family: Arial, sans-serif;
  background-color: #0f0f0f;
  color: #ffffff;
  margin: 0;
  padding: 5px;
  min-height: 100vh;
}

.container {
  width: 100%;
  margin: 0 auto;
  background-color: #18181b;
  border-radius: 8px;
  padding-bottom: 10px;
}

/* ====================== ONGLETS ====================== */
.tabs {
  display: flex;
  justify-content: flex-start;
  gap: 5px;
  border-bottom: 1px solid #a970ff;
  margin-bottom: 10px;
}

.tab {
  padding: 5px;
  text-align: center;
  background-color: #202024;
  color: #efeff1;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  font-size: 16px;
  border-radius: 4px 4px 0 0;
  min-width: 20px;
}

.tab:hover {
  background-color: #2a2a2e;
}

.tab.active {
  background-color: #a970ff;
  color: #18181b;
  font-weight: bold;
}

.tab img,
.tab svg {
  vertical-align: middle;
}

.tab svg.live-icon { width: 24px; height: 24px; margin-top: 0; fill: white; }
.tab svg.calendar-icon { width: 20px; height: 20px; margin-top: 1px; }
.tab svg.channels-icon { width: 24px; height: 24px; }
.tab svg.notification-icon { width: 24px; height: 24px; }
.tab svg.settings-icon { width: 21px; height: 21px; margin-top: 1px; fill: white; }

#sync-status-bar {
  margin-left: auto;
  align-self: center;
  margin-bottom: 4px;
  margin-right: 4px;
  padding: 7px 12px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  pointer-events: auto;
  cursor: default;
  line-height: 1;
  border-radius: 8px;
  border: 1.5px solid rgba(0, 0, 0, 0.6);
  background-color: #2d7a3a;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: background-color 0.4s ease;
  position: relative;
}

#sync-status-bar.stale {
  background-color: #8b1a1a;
}

/* ====================== CLOCHE UPCOMING ====================== */
.upcoming-bell {
  cursor: pointer;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  align-self: center;
  margin-right: -40px;
  margin-top: -32px;
}

.upcoming-bell svg {
  width: 100%;
  height: 100%;
  fill: #ffffff;
  transition: fill 0.3s ease;
}

.upcoming-bell.yellow svg {
  fill: #ffff00;
}

/* Contenu des onglets */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ====================== GRILLES ====================== */
#channels-list,
#upcoming-channels-list,
#notification-log-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 7px;
  width: 100%;
  justify-items: center;
  scroll-behavior: smooth;
}

/* Liste des chaînes suivies (onglet Channels) */
#followed-channels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* ====================== CARTES LIVE / UPCOMING / NOTIFICATIONS ====================== */
.item-container,
.notification-card {
  width: 270px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  background-color: #0f0f0f;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.item-container:hover,
.notification-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(167, 112, 255, 0.2);
}

/* ====================== UPCOMING CARDS ====================== */
.upcoming-channel-info {
  margin-top: -18px;
  margin-right: 0px;
  z-index: 10;
}

.upcoming-channel-title {
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 700;
  text-align: right;
  color: #efeff1;
  margin: 0 -12px;
  text-shadow: 
    -1px -1px 0 #000,  
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.upcoming-countdown {
  text-align: right;
  font-size: 16px;
  color: #adadb8;
  margin: 0 -6px;
}

/* Bordures par plateforme */
.twitch-border,
.item-container.twitch-border,
.notification-card.twitch-border {
  border: 2px solid #612fac;
}

.youtube-border,
.item-container.youtube-border,
.notification-card.youtube-border {
  border: 2px solid #ff0000;
}

.item-container.yellow-border { border: 2px solid #ffff00; }
.item-container.red-border { border: 2px solid red; }

/* Header commun (avatar + infos) */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 10px;
}

.channel-info {
  align-items: right;
  margin-top: -18px;
  margin-right: -5px;
  margin-left: -360px;
  z-index: 10;
}

.channel-title {
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 700;
  text-align: right;
  color: #efeff1;
  margin: 0 -7px;
  text-shadow: 
    -1px -1px 0 #000,  
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.channel-img {
  transition: transform 0.3s;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: -30px;
  margin-top: -5px;
  margin-left: -5px;
  position: absolute;
  z-index: 10;
  border: 2px solid darkred;
}

.channel-img:hover {
  transform: scale(1.1);
}

.thumbnail {
  transition: transform 0.3s;
  width: 280px;
  height: 157px;
  object-fit: cover;
  aspect-ratio: 16/9;
  border-radius: 15px;
  margin: 0 -5px;
  display: block;
  z-index: 5;
  flex-shrink: 0;
}

.thumbnail:hover {
  transform: scale(1.04);
}

/* Textes spécifiques aux cartes */
.stream-title {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  margin-top: 7px;
  margin-bottom: -7px;
}

.viewer-count {
  text-align: right;
  font-size: 18px;
  color: rgb(235, 38, 52);
  margin: 0 -6px;
}

.game-title {
  text-align: right;
  font-size: 14px;
  color: #a970ff;
  margin: 0 -6px;
}

.stream-duration,
.notification-timestamp {
  text-align: right;
  font-size: 14px;
  color: #adadb8;
  margin: 0 -6px;
}

/* ====================== CARTES CHAÎNES SUIVIES ====================== */
.channel-card {
  display: flex;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  background-color: #202024;
  border-radius: 4px;
  text-decoration: none;
  color: #fff;
  transition: background-color 0.2s, border 0.2s;
  position: relative;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.channel-card:hover {
  background-color: #2a2a2e;
}

.channel-card.twitch-border { border: 2px solid #612fac; }
.channel-card.youtube-border { border: 2px solid red; }
.channel-card.notifications-enabled { border: 2px solid #ffd700; }

.channel-card .avatar {
  width: 50px;
  height: 50px;
  margin-right: 10px;
}

.channel-card .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.channel-card .channel-title {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 700;
  color: #efeff1;
  margin: 0;
}

.channel-card .subscription-date {
  font-size: 14px;
  color: #adadb8;
  margin: 4px 0 0;
}

.channel-card .notification-bell {
  cursor: pointer;
  width: 24px;
  height: 24px;
  fill: #efeff1;
  transition: fill 0.2s;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.channel-card .notification-bell.active {
  fill: #ffd700;
}

.channel-card .autolaunch-btn {
  cursor: pointer;
  width: 24px;
  height: 24px;
  fill: #efeff1;
  transition: fill 0.2s;
  position: absolute;
  right: 42px;
  top: 55%;
  transform: translateY(-50%);
}

.channel-card .autolaunch-btn.active {
  fill: #00e676;
  color: #00e676;
}

/* ====================== NOTIFICATIONS VOLANTES (top-right) ====================== */
.notifications-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: 300px;
  z-index: 1000;
}

.notification {
  background-color: #202024;
  color: #efeff1;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #a970ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.notification-close {
  cursor: pointer;
  color: #ff5555;
  font-weight: bold;
  margin-left: 10px;
}

/* ====================== BOUTONS & AUTRES ====================== */
.login-button,
.youtube-login-button {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #fff;
  max-width: 280px;
  height: 20px;
}

.login-button { background-color: #467a57; }
.login-button:hover { background-color: #b43d3d; }

.youtube-login-button { background-color: #ff4444; }
.youtube-login-button:hover { background-color: rgb(129, 129, 213); }

.sort-search-container {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
  max-width: 298px;
}

.sort-selector,
.search-input {
  flex: 1;
  padding: 8px;
  background-color: #202024;
  color: #efeff1;
  border: 1px solid grey;
  border-radius: 4px;
  font-size: 14px;
}

.sort-selector:focus,
.search-input:focus {
  outline: none;
  border-color: grey;
}

.search-input {
  max-width: 138px;
}

.search-input::placeholder {
  color: #adadb8;
}

/* ====================== BELL BUTTON (Upcoming) ====================== */
.bell-button {
  transition: transform 0.3s ease;
  cursor: pointer;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bell-button:hover {
  transform: scale(1.2);
}

.bell-button svg {
  width: 100%;
  height: 100%;
  fill: #ffffff;           /* Blanc par défaut */
  transition: fill 0.3s ease;
}

/* Quand la cloche est activée (jaune) */
.bell-button.yellow svg {
  fill: #ffff00 !important;   /* Jaune + !important pour forcer */
}

/* Optionnel : effet au hover quand elle est jaune */
.bell-button.yellow:hover svg {
  fill: #ffe600;
}

/* ====================== LOADER & ERREURS ====================== */
.loader {
  text-align: center;
  color: #a970ff;
  font-size: 14px;
  margin-bottom: 20px;
}

.loader::after {
  content: "Chargement.";
  display: inline-block;
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0% { content: "Chargement."; }
  33% { content: "Chargement.."; }
  66% { content: "Chargement..."; }
}

.error {
  color: #ff5555;
  text-align: center;
}

/* ====================== UTILITAIRES ====================== */
.text-gray-300 { color: #d1d5db; }
.text-blue-400 { color: #3ea6ff; }
.text-red-500 { color: #ef4444; }
.font-bold { font-weight: 700; }
.hover\:text-blue-400:hover { color: #3ea6ff; }
.mb-2 { margin-bottom: 0.5rem; }
