/* --- General Layout --- */
:root {
  --background-color: #0d1117;
  --widget-bg-color: rgba(22, 27, 34, 0.8);
  --text-color: #c9d1d9;
  --main-text-color: #e6edf3;
  --text-secondary-color: #8b949e;
  --accent-color: #58a6ff;
  --border-color: #30363d;
  --bg-color: #0d1117;
  --font-family: 'Roboto Mono', monospace;
  --font-family-mono: 'Roboto Mono', monospace;
  --border-radius: 8px;
  --red-color: #f85149;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
}

.header {
  background-color: var(--widget-bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px;
  color: var(--main-text-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.back-button {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--main-text-color);
  text-decoration: none;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.back-button:hover {
  color: var(--accent-color);
}

.strategy-container {
  padding: 0 20px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.widget {
  background-color: var(--widget-bg-color);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
}

/* --- Controls --- */
.controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: bold;
    color: var(--text-secondary-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-element {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
}

.control-element:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

select.control-element {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%238b949e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select.control-element::-ms-expand {
    display: none;
}

select.control-element:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%2358a6ff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.input-area {
  display: flex;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  padding: 5px;
  align-items: flex-start;
}

.input-area:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

#strategy-input {
  flex-grow: 1;
  background: none;
  border: none;
  color: var(--text-color);
  resize: vertical;
  min-height: 50px;
  max-height: 250px;
  padding: 8px;
  font-size: 1rem;
  font-family: inherit;
}
#strategy-input:focus {
  outline: none;
}

#generate-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  align-self: center;
  transition: color 0.2s ease;
}

#generate-btn:hover {
  color: var(--accent-color);
}

#generate-btn.loading {
    cursor: not-allowed;
}

.control-button {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.control-button:hover {
  background-color: #0056b3;
}

.control-button:active {
  transform: scale(0.98);
}

.compact-btn {
  padding: 5px 10px;
  font-size: 0.9rem;
}

/* --- Results --- */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.results-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 15px;
  line-height: 1.6;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary-color);
}

.placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* --- Markdown Formatting --- */
.results-container h1,
.results-container h2,
.results-container h3,
.results-container h4 {
    color: var(--main-text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.results-container ul,
.results-container ol {
  padding-left: 20px;
  color: var(--secondary-text-color);
}

.results-container li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.results-container strong {
  color: var(--main-text-color);
}

.results-container code {
    background-color: var(--bg-color);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: var(--font-family-mono);
}

.results-container pre {
    background-color: var(--bg-color);
    padding: 1em;
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.results-container blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1em;
    margin-left: 0;
    color: var(--text-secondary-color);
}

/* --- Utility --- */
.loading-indicator {
  text-align: center;
  padding: 40px;
  color: var(--secondary-text-color);
  font-size: 1.2rem;
}
.loading-indicator .fa-spinner {
  margin-right: 10px;
}

.error-message {
  color: var(--red-color);
  text-align: center;
  padding: 40px;
  font-weight: 500;
}

/* --- Media Queries --- */
@media (max-width: 768px) {
  .header {
    padding: 15px 10px;
  }
  .header h1 {
    font-size: 1.2rem;
    margin: 0;
  }
  .back-button {
    left: 10px;
    font-size: 1.2rem;
  }
  .back-button .back-text {
    display: none;
  }
  .strategy-container {
    padding: 0 10px 10px;
  }
  .widget {
    padding: 15px;
    height: auto;
  }
}

/* --- Light Theme --- */
body[data-theme="light"] {
    --bg-color: #f0f2f5;
    --widget-bg-color: #ffffff;
    --border-color: #d9d9d9;
    --text-color: #1f1f1f;
    --main-text-color: #1f1f1f;
    --text-secondary-color: #606060;
    --accent-color: #1877f2;
    --red-color: #fa383e;

    background-color: var(--bg-color);
    color: var(--text-color);
}

body[data-theme="light"] .back-button {
    color: var(--main-text-color);
}

body[data-theme="light"] .control-element {
    background-color: #fff;
    border-color: #ccc;
}

body[data-theme="light"] select.control-element {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%23606060' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body[data-theme="light"] select.control-element:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%231877f2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body[data-theme="light"] #strategy-input {
    background: #fff;
}

body[data-theme="light"] #generate-btn {
    color: var(--text-secondary-color);
}

body[data-theme="light"] #generate-btn:hover {
  color: var(--accent-color);
}
