/* ===== Light theme variables (default) ===== */
:root {
  --primary:       #0052CC;
  --primary-dark:  #0747A6;
  --primary-light: #DEEBFF;
  --success:       #36B37E;
  --success-bg:    #E3FCEF;
  --error:         #DE350B;
  --error-bg:      #FFEBE6;
  --text:          #172B4D;
  --text-muted:    #5E6C84;
  --border:        #DFE1E6;
  --card-bg:       #FFFFFF;
  --input-bg:      #FFFFFF;
  --input-border:  #DFE1E6;
  --body-grad-a:   #667eea;
  --body-grad-b:   #764ba2;
  --radius:        8px;
  --transition:    0.2s ease;
}

/* ===== Dark theme variables ===== */
[data-theme="dark"] {
  --primary:       #5b8dee;
  --primary-dark:  #4070d4;
  --primary-light: #1a2840;
  --success:       #4ade80;
  --success-bg:    #052e16;
  --error:         #f87171;
  --error-bg:      #3b0f0f;
  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --border:        #2d3748;
  --card-bg:       #1a1a2e;
  --input-bg:      #252538;
  --input-border:  #3d3d5c;
  --body-grad-a:   #0f0c29;
  --body-grad-b:   #24243e;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== Body ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, var(--body-grad-a) 0%, #302b63 50%, var(--body-grad-b) 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 60px;
  color: var(--text);
  transition: background 0.3s;
}

/* ===== Card ===== */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px 36px 40px;
  width: 100%;
  max-width: 620px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
  transition: background 0.3s, color 0.3s;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Top controls row (theme + language) ===== */
.top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Theme toggle */
.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-size: 16px;
}

.theme-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 6px;
}

.lang-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  letter-spacing: -2px;
  transition: border-color 0.2s, background 0.2s;
}

.lang-btn:hover { background: var(--primary-light); }

.lang-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  border-radius: 16px;
  margin-bottom: 16px;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.header p { font-size: 14px; color: var(--text-muted); }

/* ===== Loading ===== */
.loading-msg {
  text-align: center;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.loading-dots span {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 3px;
  animation: bounce 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40%            { transform: scale(1); opacity: 1; }
}

/* ===== Form ===== */
.form-content { display: none; }
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.required { color: var(--error); margin-left: 2px; }
.optional  { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }

/* Inputs */
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color var(--transition), box-shadow var(--transition), background 0.3s;
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]::placeholder,
textarea::placeholder { color: var(--text-muted); }

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 141, 238, 0.2);
}

textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

/* Select arrow */
.select-wrapper { position: relative; }
.select-wrapper select { padding-right: 36px; cursor: pointer; }
.select-wrapper::after {
  content: '';
  position: absolute;
  right: 13px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-muted);
  pointer-events: none;
}

/* Dark select options */
[data-theme="dark"] select option {
  background: #252538;
  color: #e2e8f0;
}

/* Skeleton */
.skeleton {
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--border) 25%, var(--input-bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Submit button ===== */
.btn-submit {
  width: 100%;
  padding: 13px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  transition: background var(--transition), transform 0.1s;
}

.btn-submit:hover:not(:disabled) { background: var(--primary-dark); }
.btn-submit:active:not(:disabled) { transform: scale(0.99); }
.btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Alert ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 14px;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(222,53,11,0.3); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(54,179,126,0.3); }

/* ===== Success screen ===== */
.success-screen { text-align: center; padding: 24px 0; animation: slideUp 0.4s ease; }

.success-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px; height: 80px;
  background: var(--success-bg);
  border-radius: 50%;
  margin-bottom: 20px;
}

.success-screen h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.success-screen p  { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

.btn-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.btn-new:hover { background: var(--primary); color: #fff; }

/* ===== Epic picker ===== */
.epic-picker { position: relative; }

.epic-picker input[type="text"] { width: 100%; }

.epic-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--card-bg);
  border: 2px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.epic-option {
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.epic-option:last-child { border-bottom: none; }
.epic-option:hover { background: var(--primary-light); }

.epic-key {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.epic-hint {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.epic-name {
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Divider ===== */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ===== Responsive ===== */
@media (max-width: 560px) {
  body { padding: 20px 12px 40px; }
  .card { padding: 20px 16px 28px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
