/* Base Styles */
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  width: 300px;
  padding: 10px;
  min-height: 150px;
  background-color: #161616;
  color: white;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 15px !important;
  min-height: 0;
}

.hidden {
  display: none;
}

/* Timer Section */
.timer-box {
  background-color: #262626;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
  min-height: 120px;
}
.timer-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.timer-section .timer-label {
  font-weight: bold;
  margin-bottom: 8px;
  color: #FC9F16;
  font-size: 18px;
}
#timer {
  font-size: 2.8em;
  color: white;
  font-weight: 500; 
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em; 
}

/* Settings Icon */
#settings-btn svg {
  fill: #FC9F16 !important;
  transition: fill 0.2s ease;
}
#settings-btn:hover svg {
  fill: #E88A00 !important;
}

/* AI Assistant Section */
.ai-box {
  background-color: #262626;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 15px;
}
#ai-title {
  color: white;
  margin: 0 0 15px 0;
  font-size: 1.4em;
  font-weight: bold;
}

/* Hint Buttons */
.hints {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.hints button {
  background-color: #333333;
  color: white;
  border: none;
  padding: 10px 8px; 
  border-radius: 6px;
  font-size: 13px; 
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 80px;
  min-height: 60px; 
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hints button:hover {
  background-color: #444444;
  transform: translateY(-1px);
}
.hints button:active {
  transform: translateY(0);
}

/* Hint & Error Display */
#hint-container,
#error-container {
  margin-top: 10px;
  padding: 15px;
  border: 1px solid #444;
  border-radius: 5px;
  font-size: 15px;
  line-height: 1.4;
  background-color: #262626;
}
#hint-container h2 {
  font-size: 1.2em;
  margin-bottom: 10px;
  color: #FC9F16;
}

/* Settings Page */
#settings-view {
  background-color: #161616;
  padding: 3px;
  min-height: 150px;
}
.settings-box {
  background-color: #262626;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 15px;
  margin: 0;
}
.settings-title {
  color: #FC9F16;
  margin: 0 0 20px 0;
  font-size: 1.7em;
  font-weight: bold;
}

.close-btn {
  background: none;
  border: 2px solid #FC9F16;
  color: #FC9F16;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}
.close-btn:hover {
  background-color: #FC9F16;
  color: #161616;
}

/* Settings Form */
.settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings label {
  color: white;
  font-weight: 500;
  margin-bottom: 5px;
  display: block;
  font-size: 16px;
}
.settings input {
  background-color: #333333;
  color: white;
  border: 1px solid #444;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
}
.settings select {
  background-color: #333333;
  color: white;
  border: 1px solid #444;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px 12px;
  padding-right: 35px;
  appearance: none;
}
.settings input:focus,
.settings select:focus {
  border-color: #FC9F16;
  outline: none;
  box-shadow: 0 0 0 2px rgba(252, 159, 22, 0.2);
}
#save-settings {
  background-color: #FC9F16;
  color: #161616;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
}
#save-settings:hover {
  background-color: #E88A00;
  transform: translateY(-1px);
}

/* LeetCode Reward Popup */
.leetcode-reward-popup {
  padding: 20px;
  min-width: 280px;
  min-height: 100px;
  font-size: 1.1em;
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #262626;
  color: white;
  border: 2px solid #FC9F16;
  border-radius: 8px;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.5s, transform 0.5s;
  transform: translateX(0);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  animation: slideInRight 0.5s ease-out;
}
.time-added {
  font-weight: bold;
  color: #FC9F16;
  font-size: 1.2em;
}
.total-time {
  font-size: 0.9em;
  color: #ccc;
  margin-top: 5px;
}

/* Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Light mode */
@media (prefers-color-scheme: light) {
  body,
  #settings-view {
    background-color: #f7f7f9 !important;
    color: #262626 !important;
  }
  .timer-box,
  .ai-box,
  .settings-box,
  #hint-container,
  #error-container {
    background-color: #fff !important;
    border: 1px solid #d3d6db !important;
    color: #222 !important;
  }
  .timer-section .timer-label,
  .settings-title {
    color: #FC9F16 !important; /* Rich LeetCode yellow */
  }
  #timer {
    color: #262626 !important;
  }
  #ai-title {
    color: #262626 !important;
  }
  .hints button {
    background-color: #f9f8f6 !important;
    color: #262626 !important;
    border: 1px solid #e8eaed !important;
  }
  .hints button:hover {
    background-color: #ececec !important;
  }
  .settings label {
    color: #262626 !important;
  }
  .settings input,
  .settings select {
    background-color: #f6f7fa !important;
    color: #222 !important;
    border: 1px solid #d3d6db !important;
  }
  .settings input:focus,
  .settings select:focus {
    border-color: #FC9F16 !important;
    box-shadow: 0 0 0 2px rgba(252,159,22,0.14) !important;
  }
  #save-settings {
    background-color: #FC9F16 !important;
    color: #fff !important;
  }
  #save-settings:hover {
    background-color: #E88A00 !important;
  }
  #settings-btn svg {
    fill: #FC9F16 !important;
  }
  #settings-btn:hover svg {
    fill: #E88A00 !important;
  }
  .close-btn {
    border: 2px solid #FC9F16 !important;
    color: #FC9F16 !important;
    background: none !important;
  }
  .close-btn:hover {
    background-color: #FC9F16 !important;
    color: #fff !important;
  }
  .leetcode-reward-popup {
    background-color: #fff !important;
    color: #262626 !important;
    border: 2px solid #FC9F16 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
  }
  .time-added {
    color: #FC9F16 !important;
  }
  .total-time {
    color: #686868 !important;
  }
}

.hint-cost {
  color: white;
}

@media (prefers-color-scheme: light) {
  .hint-cost {
    color: #111 !important;
  }
}
/* Styles for the warning popup */
.leetcode-warning-popup {
    border-color: #f7b731; /* Orange border for warning */
}
.leetcode-warning-popup h3 {
    color: #f7b731;
}

/* Styles for the warning popup in light mode */
@media (prefers-color-scheme: light) {
  .leetcode-warning-popup {
      border-color: #f7b731 !important;
  }
  .leetcode-warning-popup h3 {
      color: #f7b731 !important;
  }
}
