/* Temel renkler */
:root {
  --yt-light-bg: #fff;
  --yt-light-header: #f8f8f8;
  --yt-light-sidebar: #f4f4f4;
  --yt-light-text: #0f0f0f;
  --yt-light-border: #e5e5e5;

  --yt-dark-bg: #0f0f0f;
  --yt-dark-header: #212121;
  --yt-dark-sidebar: #181818;
  --yt-dark-text: #fff;
  --yt-dark-border: #303030;

  --yt-accent: #3ea6ff;
}

/* Light Theme */
body.light-theme {
  background: var(--yt-light-bg);
  color: var(--yt-light-text);
}
body.light-theme .header {
  background: var(--yt-light-header);
  color: var(--yt-light-text);
}
body.light-theme .sidebar {
  background: var(--yt-light-sidebar);
  color: var(--yt-light-text);
}
body.light-theme .main-content {
  background: var(--yt-light-bg);
  color: var(--yt-light-text);
}
body.light-theme .stream-item {
  background: var(--yt-light-bg);
  border: 1px solid var(--yt-light-border);
}
body.light-theme .stream-item:hover {
  background: #f1f1f1;
}
body.light-theme .search-form input,
body.light-theme .search-form button,
body.light-theme #tagSearchInput {
  background: #fff;
  color: var(--yt-light-text);
  border: 1px solid var(--yt-light-border);
}
body.light-theme select {
  background: #fff;
  color: var(--yt-light-text);
  border: 1px solid var(--yt-light-border);
}

/* Local search button themes */
body.light-theme #local-search-btn {
  background: #ff6b6b !important;
  color: white !important;
}
body.dark-theme #local-search-btn {
  background: #ff6b6b !important;
  color: white !important;
}

/* Local search modal themes */
body.light-theme #local-search-modal .search-modal-content {
  background: var(--yt-light-bg) !important;
  color: var(--yt-light-text) !important;
}
body.light-theme #local-search-modal input {
  background: #f0f0f0 !important;
  color: var(--yt-light-text) !important;
  border-color: var(--yt-light-border) !important;
}
body.light-theme #local-search-modal #local-search-results {
  background: var(--yt-light-bg) !important;
  border-color: var(--yt-light-border) !important;
}
body.light-theme #local-search-modal .stream-title,
body.light-theme #local-search-modal .channel-title,
body.light-theme #local-search-modal .stream-viewers-overlay {
  color: var(--yt-light-text) !important;
}

/* Dark Theme */
body.dark-theme {
  background: var(--yt-dark-bg);
  color: var(--yt-dark-text);
}
body.dark-theme .header {
  background: var(--yt-dark-header);
  color: var(--yt-dark-text);
}
body.dark-theme .sidebar {
  background: var(--yt-dark-sidebar);
  color: var(--yt-dark-text);
}
body.dark-theme .main-content {
  background: var(--yt-dark-bg);
  color: var(--yt-dark-text);
}
body.dark-theme .stream-item {
  background: var(--yt-dark-bg);
}
body.dark-theme .stream-item:hover {
  background: #272727;
}
body.dark-theme .search-form input,
body.dark-theme .search-form button,
body.dark-theme #tagSearchInput {
  background: #232323;
  color: var(--yt-dark-text);
  border: 1px solid var(--yt-dark-border);
}
body.dark-theme select {
  background: #232323;
  color: var(--yt-dark-text);
  border: 1px solid var(--yt-dark-border);
}

/* Ortak stiller */
html, body {
  margin: 0;
  padding: 0;
  padding-top: 45px; /* Offset for fixed header */
  font-family: Arial, sans-serif;
}


.header {
  padding: 10px;
  height: 45px;
  display: flex;
  align-items: center;
  position: fixed; /* Fix header to the viewport */
  top: 0;           /* Position at the top */
  left: 0;          /* Align to the left */
  right: 0;         /* Align to the right (ensures full width) */
  gap: 16px;
  justify-content: space-between;
  z-index: 100;
}

.header h1 a {
  color: inherit;
  text-decoration: none;
}

/* --- Local Search Bar --- */
#advanced-search-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  max-width: 200px;
  min-width: 300px;
}

#advanced-search-container > div {
    position: relative;
    width: 100%;
}

#advanced-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

#advanced-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 400px;
  overflow-y: auto;
  background: #222;
  border: 1px solid #444;
  border-radius: 6px;
  z-index: 1000;
  display: none;
  margin-top: 4px;
}
/* --- End Local Search Bar --- */

#mobile-search-icon {
  display: none; /* Hide the icon by default */
}

/* Mobile-specific styles for Advanced Search */
@media screen and (max-width: 768px) and (orientation: portrait) {
  .header {
    flex-direction: row;    /* Keep items on a single line */
    flex-wrap: nowrap;      /* Prevent wrapping */
    align-items: center;    /* Vertically center items */
    height: 60px;           /* Set a fixed, compact height */
    padding: 0 0.75rem;     /* Adjust padding */
    gap: 0.75rem;           /* Space between logo and search */
  }

  .header #logo-img {
    height: 30px;           /* A smaller logo for mobile */
    margin: 0;
    flex-shrink: 0;         /* Prevent the logo from shrinking */
  }

  #search-formi {
    flex-grow: 1;           /* Allow the form to fill remaining space */
    width: auto;            /* Reset width */
    margin-right: 0 !important;
    display: flex;
  }

  #search-input {
    width: 1px !important;      /* Visually hide the input */
    height: 1px !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0 !important;
    opacity: 0 !important;
  }

  #search-formi button {
    display: none; /* Keep search button hidden on mobile */
  }

  #advanced-search-container {
    display: none; /* Hide the bar on mobile */
  }

  #mobile-search-icon {
    display: block; /* Show the icon on mobile */
    cursor: pointer; /* Add a pointer cursor */
    /* You can add more styling here, like size, color, etc. */
  }

/* Mobile-specific styles for Theater Mode */
  #video-theater-modal {
    flex-direction: column; /* Stack video and chat vertically */
  }

  .theater-content {
    flex-direction: column;
    height: 100%; /* Ensure theater-content takes full height */
  }

  .player-wrapper {
    width: 100%;
    height: auto; /* Let content define height, or use max-height */
    max-height: 50vh; /* Limit player height to 50% of viewport height */
    display: flex; /* Use flex to center video */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    overflow: hidden; /* Hide anything that overflows */
  }

  #theater-player {
    width: 100%;
    height: 100%;
  }

  #theater-player iframe {
    width: 100%;
    height: 100%;
  }

  .chat-wrapper {
    flex: 1; /* Allow chat to take remaining space */
    width: 100%;
    height: auto; /* Let flex determine height */
    min-width: unset; /* Remove min-width constraint */
    overflow-y: auto; /* Enable scrolling for chat if content overflows */
  }

  #add-channel-button {
    font-size: 0 !important; /* Hide text, force with !important */
    width: 30px !important; /* Make it square, force with !important */
    height: 30px !important; /* Make it square, force with !important */
    padding: 0 !important; /* Remove padding, force with !important */
    border-radius: 50% !important; /* Make it round, force with !important */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffb347 !important; /* Original button background, force with !important */
    color: white !important; /* Plus sign color, force with !important */
    margin-right: -14px;
  }

  #add-channel-button::before {
    content: "+" !important;
    font-size: 24px !important;
    line-height: 1 !important;
  }

  #channel-count-display {
    display: none !important; /* Hide the channel count text on mobile */
  }
}

@media screen and (max-width: 768px) and (orientation: landscape) {
  #video-theater-modal {
    flex-direction: row; /* Side-by-side for landscape */
  }

  .player-wrapper {
    width: 70%; /* Give more space to the video */
    height: 100%;
    max-height: 100vh;
  }

  .chat-wrapper {
    width: 30%; /* Less space for the chat */
    height: 100%;
  }
}




.search-form {
  display: flex;
  align-items: center;
}
.search-form input,
#tagSearchInput {
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: none !important;
  font-size: 0 !important;
  opacity: 0;
  border-radius: 3px;
  outline: none;
}
.search-form input,
#search-formi {
  padding: 0px;
  font-size: 0px;
  border-radius: 0px;
  outline: none;
}
.search-form button {
  padding: 0px 0px;
  font-size: 0px;
  margin-left: 0px;
  cursor: pointer;
  border-radius: 0px;
  border: none;
  background: var(--yt-accent);
  color: #fff;
}

.wrapper {
  display: flex;
  height: calc(100vh - 60px); /* header yüksekliği kadar */
}

.sidebar {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  padding: 10px;
  overflow-y: auto;
  background: var(--yt-light-sidebar);
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px;
  box-sizing: border-box;
}



#streams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  align-content: start;
  min-width: 0;
  padding-bottom: 16px;
}

.stream-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 4px;
  padding: 2px;
  cursor: pointer;
  transition: background-color 0.2s;
  min-width: 0;
  box-sizing: border-box;
  min-height: 220px;
}

.stream-info {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.stream-thumb-container {
  position: relative;
  width: 100%;
}
.stream-thumbnail {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}
.stream-viewers-overlay {
  position: absolute;
  left: 9px;
  bottom: 9px;
  background: rgba(34,34,34,0.85);
  color: #ffffff;
  font-size: 15px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 2px;
  box-shadow: 0 1px 4px #0003;
  pointer-events: none;
  z-index: 2;
}
body.light-theme .stream-viewers-overlay {
  background: rgba(255,255,255,0.85);
  color: #222;
  box-shadow: 0 1px 4px #ccc3;
}

.stream-viewers {
  color: #888;
  font-size: 14px;
  text-align: center;
}

/* Kanal bilgileri */
.channel-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
  padding: 0 4px;
}

.channel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px; /* Başlığın ilk satırıyla hizala */
}

.channel-title-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.stream-title {
  margin: 0;
  font-size: 18px;
  text-align: left;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0;
  min-height: auto;
}

.channel-title {
  font-size: 14px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Dark theme için kanal title rengi */
body.dark-theme .channel-title {
  color: #aaa;
}

body.light-theme .channel-title {
  color: #666;
}

/* Hashtag stilleri */
.hashtag-container {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 8px;
  overflow: hidden;
  width: 100%;
}

.hashtag-item {
  font-size: 12px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
  background: #9146ff;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid rgba(145, 70, 255, 0.3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.hashtag-item:hover {
  background: #772ce8;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.light-theme .hashtag-item {
  background: #e1e1e1;
  color: #353535;
  border: 1px solid rgba(145, 70, 255, 0.3);
}

body.light-theme .hashtag-item:hover {
  background: #c0c0c0;
}

body.dark-theme .hashtag-item {
  background: #434343;
  color: #fff;
  border: 1px solid rgba(145, 70, 255, 0.3);
}

body.dark-theme .hashtag-item:hover {
  background: #242424;
}

#langArea {
  margin-bottom: 10px;
}

/* Sadece streams-container scroll barı görünsün, diğerleri gizli */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.wrapper::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  background: transparent !important;
}
#streams-container::-webkit-scrollbar {
  width: 8px;
}
#streams-container::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}
.header #logo-img {
  height: 55px;
  margin-right: 16px;
  vertical-align: middle;
  margin-left: 10px;
}

/* Settings Panel */
#settings-panel {
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.switch-container {
  display: flex;
  align-items: center;
}

/* The switch - the box around the slider */
#dark-mode-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  background-color: #ccc;
  border-radius: 20px;
  transition: background-color 0.2s;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
}

/* The slider */
#dark-mode-switch::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

/* Checked state */
#dark-mode-switch:checked {
  background-color: #3ea6ff;
}

#dark-mode-switch:checked::before {
  transform: translateX(20px);
}

/* Local Search Modal */
#local-search-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-modal-content {
  background-color: #181818;
  padding: 20px;
  border-radius: 8px;
  width: 80%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#local-search-input {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #303030;
  border-radius: 4px;
  background-color: #212121;
  color: #fff;
}

#local-search-results {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #303030;
  border-radius: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 10px;
  gap: 15px;
  border-bottom: 1px solid #303030;
  cursor: pointer;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background-color: #272727;
}

.search-result-item img {
  width: 120px;
  height: 67px;
  object-fit: cover;
  border-radius: 4px;
}

.search-result-item .stream-title {
  font-size: 16px;
}
.search-result-item .channel-title {
  font-size: 14px;
  color: #aaa;
}
.search-result-item .stream-viewers-overlay {
  font-size: 13px;
}

#close-local-search {
  align-self: flex-end;
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
}

#search-buttons {
  display: flex;
  gap: 10px;
}

#search-buttons button {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #303030;
  cursor: pointer;
}

#search-buttons button#search-all {
  background-color: #3ea6ff;
  color: #fff;
}

#search-buttons button#clear-search {
  background-color: #ff6b6b;
  color: #fff;
}

/* Scrollbar for local search results */
#local-search-results::-webkit-scrollbar {
  width: 6px;
}
#local-search-results::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}
#local-search-results::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Tiyatro Modu Stilleri */
html.theater-active,
body.theater-active {
  padding-top: 0;
}

body.theater-active .header,
body.theater-active .wrapper {
  display: none; /* Tiyatro modunda header ve ana içeriği gizle */
}

#video-theater-modal {
  position: relative; /* For the error notification */
  width: 100%;
  height: 100vh; /* Ekran yüksekliğinin tamamını kapla */
  background-color: #000;
  display: flex; /* Varsayılan olarak gizli, JS ile flex yapılacak */
}

.theater-content {
  display: flex;
  width: 100%;
  height: 100%;
}

.player-wrapper {
  flex: 3;
  height: 100%;
}

.chat-wrapper {
  flex: 1;
  height: 100%;
  min-width: 300px;
}

#theater-player, #theater-chat {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #000;
}

#video-error-notification {
    position: absolute;
    top: 20px; /* Position at the top */
    left: 50%;
    transform: translateX(-50%); /* Center horizontally */
    background-color: #D32F2F; /* Red background */
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 1.3em;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.icon-warning {
    font-size: 1.5em;
    font-weight: bold;
    color: #FFC107; /* Yellow color */
    background-color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.error-message {
    flex-grow: 1;
    text-align: center;
}

.close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 1.6em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.close-btn:hover {
    transform: scale(1.2);
}

@media screen and (max-width: 768px) {
  #video-error-notification {
    padding: 10px 15px;
    font-size: 1em;
    gap: 10px;
    width: 80%;
  }

  .icon-warning {
    font-size: 1.2em;
    width: 24px;
    height: 24px;
  }

  .close-btn {
    top: 5px;
    right: 8px;
    font-size: 1.4em;
  }
}ght: 8px;
    font-size: 1.4em;
  }
}