
:root {
  /* Dark theme (default) */
  --bg-primary: #0b1622;
  --bg-secondary: #1a2332;
  --bg-tertiary: #151f2e;
  --bg-quaternary: #32445b;
  --text-primary: #8596a5;
  --text-secondary: #a8b5c4;
  --border-color: #32445b;
  --hover-bg: #2a3441;
  --special-color: #00bfff;
  --special-color-hover: #57d5ff;
}

[data-theme="light"] {
  --bg-primary: #e7f0f8;
  --bg-secondary: #b7e0f7;
  --bg-tertiary: #DCECF8;
  --bg-quaternary: #ffffff;
  --text-primary: #0b5f97;
  --text-secondary: #0b5f97;
  --border-color: #DCECF8;
  --hover-bg: #cfe8f7;
  --special-color: #E846C4;
  --special-color-hover: #a82a8d;
}

[data-theme="brown"] {
  --bg-primary: #271c19;
  --bg-secondary: #55423d;
  --bg-tertiary: #5e4a43;
  --bg-quaternary: #3f2d28;
  --text-primary: #faeee7;
  --text-secondary: #faeee7;
  --border-color: #3f2d28;
  --hover-bg: #3f2d28;
  --special-color: #df5c38;
  --special-color-hover: #dd866e;
}

a{
  color: var(--special-color)
}

a:hover{
  color: var(--special-color-hover)
}

p {
  color: var(--text-primary);
}

/* --- Scoring System Section --- */
.scoring-system-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

#rating-mode-select {
  width: 100%;
  max-width: 220px;
  font-size: 1rem;
  text-align: center;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.6rem;
  margin-bottom: 4.7rem;
}

.scoring-system-save {
  margin: 0 !important;
  padding: 0.6rem 1.5rem;
}
/* settings.css */

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

h1 {
  margin-bottom: 1rem;
  font-size: 1.8rem;
  color: var(--text-primary);
}



/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

th,
td {
  padding: 8px;
  border: 1px solid var(--border-color);
  text-align: left;
}

input,
select {
  width: 100%;
  padding: 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.95rem;
}

button {
  padding: 6px 12px;
  border: none;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover {
  background-color: var(--bg-quaternary);
}

button:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.settings-page-content {
  margin-top: 5.5rem;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
}

.tab-button {
  padding: 1rem 2rem;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border-top: 3px solid transparent;
  font-size: 1rem;
  border-radius: 4px 4px 0 0;
}

.tab-button:hover {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.tab-button.active {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-top-color: var(--text-secondary);
}

.tab-content {
  display: none;
  padding: 2rem 0;
}

.tab-content.active {
  display: block;
}

table input,
table select {
  height: 32px;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  background: var(--bg-quaternary);
}

table td:last-child .save-btn {
  float: left;
}

table td:last-child .delete-btn {
  float: right;
}

.backup-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.backup-actions button {
  padding: 0.4rem 0.8rem;
  font-size: 0.95rem;
  cursor: pointer;
  background-color: var(--bg-primary);
}

.backup-actions button:hover {
  background-color: var(--bg-quaternary);
}

.collapsible-content h3 {
  display: flex;
  align-items: center;
  justify-content: center;
}

#nav-items-form {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.nav-item-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--hover-bg);
  border-radius: 6px;
  transition: background-color 0.2s ease;
}


.nav-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  user-select: none;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 0.5rem;
}

.nav-buttons-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.move-up,
.move-down {
  background: var(--bg-quaternary);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  user-select: none;
  transition: all 0.2s ease;
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.move-up:hover,
.move-down:hover {
  background: var(--special-color);
  color: white;
}

.nav-item-row .toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-primary);
  margin: 0;
  position: relative;
}

.toggle-visible {
  cursor: pointer;
  width: 16px;
  height: 16px;
  transform: scale(1.4);
}

.toggle-visible:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--hover-bg);
  color: var(--text-secondary);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 0.3rem;
}

.nav-form-save {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 1rem;
}

.save-nav-btn {
  display: block;
  margin: 1.5rem auto 0 auto;
  padding: 0.6rem 1.5rem;
  background-color: var(--bg-primary);
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.save-nav-btn:hover {
  background-color: var(--bg-quaternary);
  transform: translateY(-1px);
}

.preferences-section .save-nav-btn {
  margin-top: 1rem;
}

.save-nav-btn:hover {
  background-color: var(--bg-quaternary);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

.preferences-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.preferences-form .toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hover-bg);
}

.preferences-form .toggle-label:last-of-type {
  border-bottom: none;
}

.preferences-form .preferences-save {
  margin-top: 0.5rem;
  align-self: center;
  padding: 0.6rem 1.5rem;
}

input[type="checkbox"] {
  width: auto;
  margin: 0;
  transform: scale(1.4);
}

.settings-separator {
  display: block;
  margin: 2.5rem auto;
  width: 90%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
  border: none;
}

.preferences-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 0 0;
}

.preferences-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.preferences-section h3 {
  margin: 0 0 1.2rem 0;
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.8rem;
}

.nav-buttons-section {
  grid-column: 1 / -1;
  max-width: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Theme Selector Styles */
.theme-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.theme-option:hover:not(.disabled) {
  background: var(--hover-bg);
}

.theme-option[data-theme="dark"]:hover {
  background: #2a3441;
}

.theme-option[data-theme="light"]:hover {
  background: #cfe8f7;
}

.theme-option[data-theme="brown"]:hover {
  background: #3f2d28;
}

.theme-option[data-theme="dark"] span {
  color: #8596a5;
}

.theme-option[data-theme="light"] span {
  color: #0b5f97;
}

.theme-option[data-theme="brown"] span {
  color: #faeee7;
}

.theme-option[data-theme="green"] span {
  color: white;
}

.theme-option.active {
  background: var(--bg-quaternary);
}

.theme-option.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.theme-cube {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.theme-dark {
  background: #0b1622;
  color: #8596a5;
}

.theme-light {
  background: #e7f0f8;
  color: #0b5f97;
}

.theme-brown {
  background: #271c19;
  color: #faeee7;
}

.theme-green {
  background: #0d4f3c;
  color: #ffffff;
}

.theme-option span {
  font-size: 0.9rem;
  font-weight: 500;
}

.theme-option.active span {
  color: var(--text-secondary);
}

/* Information section link hover effects */


@media (orientation: portrait) {
  body {
    padding-top: 12rem;
  }
  .settings-page-content{
    transform: scale(2);
    transform-origin: top;
    max-width: 28.5rem;
  }

  .settings-tabs {
    transform: scale(1);
    transform-origin: top;
    margin-bottom: 1rem;
    width: 100%;
  }

  .tab-button {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }

  .preferences-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #nav-items-form{
    grid-template-columns: repeat(2, 1fr);
    transform: scale(1.1);
    transform-origin: top;
    padding-bottom: 3rem;
  }

  .backup-actions {
    flex-direction: column;
    align-items: center;
  }

  table {
    font-size: 0.8rem;
  }

  table input, table select {
    font-size: 0.7rem;
    padding: 2px 4px;
  }
}