/* ==========================================================================
  CSS VARIABLES - Color schemes for light and dark mode
  ========================================================================== */

:root {
  /* Light mode colors */
  --bg-color-light: hsl(0, 0%, 100%);        /* White background */
  --text-color-light: hsl(0, 0%, 20%);       /* Dark gray text */
  --border-color-light: hsl(0, 0%, 87%);     /* Light gray borders */
  --accent-color-light: hsl(210, 100%, 42%); /* Blue accent */
  --hover-color-light: hsl(0, 0%, 96%);      /* Very light gray for hover states */

  /* Dark mode colors */
  --bg-color-dark: hsl(0, 0%, 12%);          /* Very dark gray background */
  --text-color-dark: hsl(0, 0%, 94%);        /* Off-white text */
  --border-color-dark: hsl(0, 0%, 27%);      /* Medium gray borders */
  --accent-color-dark: hsl(207, 69%, 55%);   /* Lighter blue accent for dark mode */
  --hover-color-dark: hsl(0, 0%, 16%);       /* Slightly lighter than background for hover */

  /* Default theme (light mode) */
  --bg-color: var(--bg-color-light);
  --text-color: var(--text-color-light);
  --border-color: var(--border-color-light);
  --accent-color: var(--accent-color-light);
  --hover-color: var(--hover-color-light);
}

/* ==========================================================================
  BASE ELEMENTS
  ========================================================================== */

html,
body {
  width: 300px;
  height: auto;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
   Ubuntu, Cantarell, 'Open Sans', sans-serif;
  font-size: 14px;
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* ==========================================================================
  DARK MODE MEDIA QUERY
  ========================================================================== */

@media (prefers-color-scheme: dark) {
  :root {
   /* Switch to dark mode variables when system preference is dark */
   --bg-color: var(--bg-color-dark);
   --text-color: var(--text-color-dark);
   --border-color: var(--border-color-dark);
   --accent-color: var(--accent-color-dark);
   --hover-color: var(--hover-color-dark);
  }
}

/* ==========================================================================
  LAYOUT COMPONENTS
  ========================================================================== */

.popup-container {
  padding: 16px;
}

header {
  margin-bottom: 16px;
  text-align: center;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-color);
}

/* ==========================================================================
  FORM ELEMENTS - Language selection controls
  ========================================================================== */

.language-selector {
  margin-bottom: 16px;
}

.selector-group {
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 14px;
}

select:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* ==========================================================================
  ACTION BUTTONS - Primary and secondary interaction elements
  ========================================================================== */

.actions {
  margin: 20px 0;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Base button styles */
.primary-button,
.secondary-button {
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

/* Primary action button */
.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--accent-color);
  color: hsl(0, 0%, 100%);
  box-shadow: 0 2px 4px hsla(0, 0%, 0%, 0.1);
}

.primary-button div {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Keyboard shortcut hint */
.shortcut-hint {
  font-size: 11px;
  opacity: 0.7;
  font-weight: normal;
  color: hsla(0, 0%, 100%, 0.9);
}

/* Secondary action button */
.secondary-button {
  background-color: var(--hover-color);
  color: var(--text-color);
}

/* Button hover and active states */
.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

/* Play icon for audio buttons */
.play-icon {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid hsl(0, 0%, 100%);
}




/* ==========================================================================
  LINK SECTION - External links and additional resources
  ========================================================================== */

.links {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.link-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  background-color: hsl(214, 13%, 16%);
  color: hsl(0, 0%, 100%);
  flex: 1;
}

.signout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  background-color: transparent;
  color: hsl(0, 0%, 60%);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  flex: 1;
}

.link-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 2px 5px hsla(0, 0%, 0%, 0.15);
}

.link-button:active {
  transform: translateY(1px);
}

.signout-button:hover {
  background-color: var(--hover-color);
  border-color: var(--accent-color);
  color: var(--text-color);
  transform: translateY(-1px);
}

.signout-button:active {
  transform: translateY(1px);
  background-color: var(--accent-color);
  color: hsl(0, 0%, 100%);
}

.signout-button:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Signout button visibility states */
.signout-button.hidden {
  display: none;
}

/* Center GitHub button when signout is hidden */
.links:has(.signout-button.hidden) {
  justify-content: center;
}

/* Fallback for browsers that don't support :has() */
.links.center-github {
  justify-content: center;
}

.links.center-github .link-button {
  flex: none;
  max-width: 50%;
}

.github-icon {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
  RESPONSIVE STYLES - Adjustments for smaller screens
  ========================================================================== */

@media (max-width: 280px) {
  .action-buttons {
   flex-direction: column;
  }

  .primary-button {
   flex-direction: column;
   align-items: center;
  }

  .shortcut-hint {
   font-size: 10px;
   margin-top: 4px;
  }
}

/* ==========================================================================
  THEME TOGGLER STYLES
  ========================================================================== */

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.theme-toggle-container {
  flex-shrink: 0;
}

.theme-toggler {
  display: flex;
  align-items: center;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background-color: var(--hover-color);
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(0);
  background-color: var(--accent-color);
  color: white;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-toggle-btn:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.theme-toggle-btn:hover .theme-icon svg {
  transform: scale(1.1);
}

.theme-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Theme transition animations */
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Theme class overrides for manual theme selection */
.theme-light {
  --bg-color: var(--bg-color-light) !important;
  --text-color: var(--text-color-light) !important;
  --border-color: var(--border-color-light) !important;
  --accent-color: var(--accent-color-light) !important;
  --hover-color: var(--hover-color-light) !important;
}

.theme-dark {
  --bg-color: var(--bg-color-dark) !important;
  --text-color: var(--text-color-dark) !important;
  --border-color: var(--border-color-dark) !important;
  --accent-color: var(--accent-color-dark) !important;
  --hover-color: var(--hover-color-dark) !important;
}

/* ==========================================================================
  GOOGLE SIGN-IN BUTTON STYLES
  ========================================================================== */

.google-signin-button {
  width: 100%;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 12px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #3c4043;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.google-signin-button:hover {
  background: #f8f9fa;
  border-color: #dadce0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.google-signin-button:active {
  background: #f1f3f4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.google-signin-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Dark mode styles for Google Sign-in button */
[data-theme="dark"] .google-signin-button,
.theme-dark .google-signin-button {
  background: var(--bg-color);
  border-color: var(--border-color);
  color: var(--text-color);
}

[data-theme="dark"] .google-signin-button:hover,
.theme-dark .google-signin-button:hover {
  background: var(--hover-color);
  border-color: var(--accent-color);
}

[data-theme="dark"] .google-signin-button:active,
.theme-dark .google-signin-button:active {
  background: var(--hover-color);
}
