/* Dark Mode Variables */
:root {
  --primary-color: #4285f4;
  --secondary-color: #34a853;
  --accent-color: #fbbc05;
  --danger-color: #ea4335;
  --light-color: #f8f9fa;
  --dark-color: #202124;
  --gray-color: #5f6368;
  --border-color: #dadce0;
  --shadow-color: rgba(0, 0, 0, 0.1);

  /* Background and text colors */
  --bg-color: #ffffff;
  --text-color: var(--dark-color);
  --card-bg-color: var(--light-color);
  --modal-bg-color: #ffffff;
  --input-bg-color: #ffffff;
  --header-bg-color: var(--primary-color);
  --header-text-color: #ffffff;
  --tab-active-color: var(--primary-color);
  --tab-active-bg: transparent;
  --result-item-bg: var(--light-color);
}

/* Dark mode colors */
[data-theme="dark"] {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --card-bg-color: #1e1e1e;
  --modal-bg-color: #2d2d2d;
  --input-bg-color: #333333;
  --header-bg-color: #1a1a1a;
  --header-text-color: #e0e0e0;
  --border-color: #444444;
  --tab-active-color: var(--primary-color);
  --tab-active-bg: #333333;
  --result-item-bg: #333333;
  --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Apply variables to elements */
body {
  font-family: Arial, sans-serif;
  line-height: 1.6;

  color: var(--text-color);
  background-color: var(--bg-color);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header Styles */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;

  background-color: var(--header-bg-color);
  color: var(--header-text-color);
  box-shadow: 0 2px 4px var(--shadow-color);
  transition: background-color 0.3s ease;
}

.logo {
  display: flex;
  align-items: center;
}

.logo a {
  display: flex;
  align-items: center;
  color: white;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: bold;
}

#logo-img {
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border-radius: 50%;
}

nav {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-btn {
  background-color: transparent;
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s;
}

.nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Main Layout */
main {
  display: flex;
  height: calc(100vh - 120px);
  padding: 20px;
}

/* Wheel Indicator */
#wheel-indicator {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 25px solid var(--primary-color);
  z-index: 5;
  filter: drop-shadow(0 2px 3px var(--shadow-color));
}

/* Add a pulsing animation to make the indicator more noticeable */
@keyframes pulse {
  0% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.1);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

/* Apply the animation when the wheel is spinning */
.wheel-spinning #wheel-indicator {
  animation: pulse 1s infinite;
}

/* Adjust the wheel container to accommodate the indicator */
.wheel-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 30px; /* Add padding to make room for the indicator */
}

#wheel-canvas {
  max-width: 100%;
  max-height: 100%;
}

#wheel-center {
  position: absolute;
  width: 50px;
  height: 50px;
  background-color: white;
  border-radius: 50%;
  z-index: 2;
}

#spin-text {
  position: absolute;
  text-align: center;
  color: white;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 3;
  pointer-events: none;
}

.sidebar {
  width: 300px;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.tab {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab.active {
  border-bottom-color: var(--tab-active-color);
  color: var(--tab-active-color);
  background-color: var(--tab-active-bg);
}

.tab span {
  /* display: inline-block;
  background-color: var(--gray-color); */
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 20px;
}

.hide-checkbox {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding: 10px 15px;
}

.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Entry Actions */
.entry-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}

.entry-actions button,
.result-actions button {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.entry-actions button:hover,
.result-actions button:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Entries and Results Lists */
.entries-list,
.results-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#entries-textarea {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  font-size: 0.9rem;
  line-height: 1.5;
  outline: none;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.result-item {
  padding: 8px;
  border-radius: 4px;
  background-color: var(--result-item-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
}

.result-item button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-color);
}

.result-item button:hover {
  color: var(--danger-color);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: var(--modal-bg-color);
  border-radius: 8px;
  box-shadow: 0 4px 8px var(--shadow-color);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.modal-tab {
  padding: 10px 15px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  margin-right: 5px;
  background-color: var(--card-bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.modal-tab.active {
  background-color: var(--modal-bg-color);
  border-bottom-color: var(--modal-bg-color);
  position: relative;
  bottom: -1px;
}

.modal-tab-content {
  margin-bottom: 20px;
}

.option-group {
  margin-bottom: 20px;
}

.option-group h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.sound-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.sound-selector select {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.sound-play-btn,
.sound-stop-btn {
  background-color: var(--light-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  margin-bottom: 5px;
}

.volume-labels,
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--gray-color);
}

.checkbox-label {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 10px;
}

.help-text {
  font-size: 0.9rem;
  color: var(--gray-color);
  margin-bottom: 10px;
}

#popup-message {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 10px;
}

.wheel-appearance-options {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}

.appearance-option {
  text-align: center;
}

.appearance-option img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 2px solid transparent;
  cursor: pointer;
}

.appearance-option img:hover {
  border-color: var(--primary-color);
}

#apply-theme-btn {
  width: 100%;
  padding: 10px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.color-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.color-picker {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
}

.color-picker input[type="color"] {
  width: 100%;
  height: 100%;
  border: none;
  cursor: pointer;
}

.image-btn {
  width: 60px;
  height: 60px;
  background-color: var(--light-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  margin-bottom: 15px;
}

#image-size {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 100px;
}

#page-bg-color {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 15px;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.modal-btn.primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.modal-btn:not(.primary) {
  background-color: var(--light-color);
  border: 1px solid var(--border-color);
}

/* Winner Modal */
.winner-content {
  text-align: center;
  padding: 30px;
}

#winner-message {
  margin-bottom: 20px;
  color: var(--gray-color);
}

#winner-name {
  font-size: 2rem;
  margin-bottom: 30px;
  color: var(--primary-color);
}

.winner-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

/* Footer */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--gray-color);
}

.version {
  margin-right: 20px;
}

.new-badge {
  background-color: var(--primary-color);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.7rem;
}

.changelog {
  color: var(--primary-color);
  text-decoration: none;
}

/* Reset and fix the main layout for all screen sizes */

/* Base layout */
main {
  display: flex;
  height: calc(100vh - 120px);
  padding: 20px;
}

.wheel-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 30px;
}

.sidebar {
  width: 300px;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.left-sidebar {
  width: 160px;
  min-width: 160px;
  padding: 10px;
}

/* Mobile layout fix for screens 768px and below */

/* Base layout remains unchanged for larger screens */
main {
  display: flex;
  height: calc(100vh - 120px);
  padding: 20px;
}

/* Direct fix for mobile layout issues */
@media (max-width: 768px) {
  .mobile-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
  }

  .wheel-container {
    width: 100% !important;
    height: 350px !important;
    margin-bottom: 20px !important;
  }

  .sidebar {
    width: 100% !important;
    height: auto !important;
    min-height: 200px !important;
    border-left: none !important;
    border-top: 1px solid var(--border-color) !important;
  }

  .left-sidebar {
    display: none !important;
  }
}

/* Ensure this doesn't conflict with other media queries */
@media (min-width: 769px) {
  .mobile-layout {
    display: flex !important;
    flex-direction: row !important;
    height: calc(100vh - 120px) !important;
    padding: 20px !important;
  }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  main {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 80px);
  }

  .wheel-container {
    width: 60%;
    height: 100%;
    margin-bottom: 0;
  }

  .sidebar {
    width: 40%;
    height: 100%;
    border-top: none;
    border-left: 1px solid var(--border-color);
  }
}
/* Extra small devices */
@media (max-width: 480px) {
  header {
    padding: 8px;
  }

  .logo a {
    font-size: 1rem;
  }

  #logo-img {
    width: 24px;
    height: 24px;
  }

  nav {
    gap: 2px;
  }

  .nav-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  /* Show only icons on very small screens */
  .nav-btn span {
    display: none;
  }

  main {
    padding: 5px;
  }

  .wheel-container {
    height: 50vh; /* Slightly smaller on very small screens */
    min-height: 250px;
  }

  /* Make the wheel center smaller */
  #wheel-center {
    width: 40px;
    height: 40px;
  }

  /* Adjust spin text */
  #spin-text {
    font-size: 0.8rem;
  }

  /* Adjust tabs */
  .tabs {
    flex-wrap: wrap;
  }

  .tab {
    flex-grow: 1;
    text-align: center;
    padding: 6px 5px;
    font-size: 0.8rem;
  }

  .hide-checkbox {
    padding: 6px 5px;
    font-size: 0.8rem;
  }

  /* Adjust modal content */
  .modal-content {
    width: 95%;
    padding: 15px;
  }

  .modal-tab {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  /* Adjust winner modal */
  #winner-name {
    font-size: 1.5rem;
  }

  .winner-buttons {
    flex-direction: column;
    gap: 10px;
  }

  /* Adjust color pickers */
  .color-pickers {
    gap: 5px;
  }

  .color-picker {
    width: 30px;
    height: 30px;
  }
}

/* Improve modal responsiveness */
@media (max-width: 600px) {
  .modal-content {
    max-width: 95%;
    padding: 15px;
  }

  .wheel-appearance-options {
    flex-direction: column;
    align-items: center;
  }

  .appearance-option {
    margin-bottom: 15px;
  }

  .modal-tabs {
    flex-wrap: wrap;
  }

  .modal-tab {
    margin-bottom: 5px;
  }
}

/* Medium-sized screens - transitional layout */
@media (min-width: 600px) and (max-width: 768px) {
  .wheel-container {
    height: 55vh;
    min-height: 350px;
  }
}

/* Tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  main {
    padding: 15px;
  }

  .sidebar {
    width: 250px;
  }

  .wheel-container {
    padding-top: 25px;
  }

  /* Hide left sidebar on tablets */
  .left-sidebar {
    width: 120px;
    min-width: 120px;
  }

  .ad-container-vertical {
    width: 120px;
  }
}

/* Dark mode toggle responsiveness */
@media (max-width: 768px) {
  .theme-toggle-switch {
    width: 40px;
    height: 20px;
  }

  .theme-toggle-slider:before {
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
  }

  input:checked + .theme-toggle-slider:before {
    transform: translateX(20px);
  }

  .theme-toggle-icon {
    font-size: 12px;
  }
}

/* Ad container responsiveness */
@media (max-width: 600px) {
  .ad-container {
    min-height: 50px;
    margin: 10px 0;
  }
}

/* Improve form elements responsiveness */
@media (max-width: 768px) {
  input[type="range"] {
    height: 20px;
  }

  .volume-labels,
  .range-labels {
    font-size: 0.7rem;
  }

  .checkbox-label {
    font-size: 0.9rem;
  }

  #popup-message {
    padding: 6px;
  }

  .sound-selector {
    flex-direction: column;
    align-items: flex-start;
  }

  .sound-selector select {
    width: 100%;
    margin-bottom: 5px;
  }

  .sound-play-btn,
  .sound-stop-btn {
    width: 30px;
    height: 30px;
  }
}

/* Fix for very small screens */
@media (max-width: 320px) {
  .tab span {
    display: none; /* Hide count badges on very small screens */
  }

  .entry-actions,
  .result-actions {
    justify-content: center;
  }

  .modal-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .modal-btn {
    width: 100%;
    text-align: center;
  }
}

/* Dark mode toggle styles */
.theme-toggle {
  display: flex;
  align-items: center;
  margin-left: 10px;
}

.theme-toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.theme-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.theme-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .theme-toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .theme-toggle-slider:before {
  transform: translateX(26px);
}

.theme-toggle-icon {
  margin: 0 5px;
  font-size: 14px;
}

/* Ad containers */
.ad-container {
  width: 100%;
  text-align: center;
  margin: 15px 0;
  min-height: 90px;
  overflow: hidden;
  clear: both;
}

/* Left sidebar for ads */
.left-sidebar {
  width: 160px;
  min-width: 160px;
  padding: 10px;
  background-color: var(--bg-color);
}

.ad-container-vertical {
  width: 160px;
  height: 600px; /* Standard skyscraper ad size */
  margin: 0 auto;
}

/* Adjust main layout to accommodate left sidebar */
main {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 20px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .ad-container {
    min-height: 50px;
  }
}

/* Make responsive */
@media (max-width: 1024px) {
  .left-sidebar {
    display: none; /* Hide on smaller screens */
  }
}
