* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121c;
  --bg-card: #1a1a28;
  --bg-input: #0f0f18;
  --bg-hover: #22222f;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.2);
  --discord-blue: #5865f2;
  --discord-hover: #6d78f7;
  --success: #22c55e;
  --success-hover: #4ade80;
  --success-glow: rgba(34, 197, 94, 0.2);
  --warning: #eab308;
  --error: #ef4444;
  --error-hover: #f87171;
  --priority-high: #ef4444;
  --priority-normal: #eab308;
  --priority-low: #22c55e;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(
      ellipse at top,
      rgba(139, 92, 246, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at bottom right,
      rgba(88, 101, 242, 0.05) 0%,
      transparent 50%
    );
}

.screen {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Loading Screen */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1.5rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-container p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Login Screen */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.login-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.3));
}

.login-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-discord {
  background: var(--discord-blue);
  color: white;
  font-size: 1rem;
  padding: 0.875rem 1.5rem;
  width: 100%;
  box-shadow: 0 4px 20px rgba(88, 101, 242, 0.35);
}

.btn-discord:hover {
  background: var(--discord-hover);
  box-shadow: 0 6px 24px rgba(88, 101, 242, 0.45);
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  padding: 0.875rem 1.75rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.875rem 1.75rem;
  font-size: 0.95rem;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-success {
  background: var(--success);
  color: white;
  padding: 0.875rem 1.75rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px var(--success-glow);
}

.btn-success:hover {
  background: var(--success-hover);
  box-shadow: 0 6px 24px var(--success-glow);
}

.btn-add {
  background: var(--accent-glow);
  color: var(--accent-primary);
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-sm);
}

.btn-add:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--accent-primary);
  color: var(--accent-hover);
}

.btn-logout {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 0.875rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.btn-remove {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-remove:hover {
  background: var(--error);
  color: white;
}

.btn-confirm {
  background: var(--success);
  color: white;
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-confirm:hover {
  background: var(--success-hover);
}

/* Header */
header {
  background: rgba(18, 18, 28, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.logo {
  font-size: 1.5rem;
}

.header-content h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

#user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

#user-name {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Main Content */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Form Sections */
.form-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.form-section:hover {
  border-color: var(--border-hover);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border-color);
}

.section-icon {
  font-size: 1.25rem;
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subsection {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  margin-bottom: 0.75rem;
  border: 1px solid transparent;
  transition: var(--transition);
}

.subsection:hover {
  border-color: var(--border-color);
}

.subsection:last-child {
  margin-bottom: 0;
}

/* Changelog Meta Section */
.changelog-meta {
  background: linear-gradient(
    135deg,
    var(--bg-card) 0%,
    rgba(139, 92, 246, 0.05) 100%
  );
  border: 1px solid var(--border-color);
}

.meta-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.meta-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.meta-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-select,
.meta-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
}

.meta-select:hover,
.meta-input:hover {
  border-color: var(--border-hover);
}

.meta-select:focus,
.meta-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.meta-select {
  cursor: pointer;
  appearance: none;
  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='%23a0a0b0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
  padding-right: 2rem;
}

.title-preview {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

#title-preview-text {
  font-size: 0.875rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.subsection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.625rem;
  gap: 0.5rem;
}

.subsection-title {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}

.toggle-label input {
  display: none;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: var(--bg-input);
  border-radius: 11px;
  position: relative;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.toggle-slider::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: var(--transition);
}

.toggle-label input:checked + .toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(18px);
  background: white;
}

.toggle-text {
  font-weight: 600;
  font-size: 0.875rem;
}

/* Priority Badges */
.priority-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.priority-badge.high .priority-dot {
  background: var(--priority-high);
  box-shadow: 0 0 8px var(--priority-high);
}

.priority-badge.normal .priority-dot {
  background: var(--priority-normal);
  box-shadow: 0 0 8px var(--priority-normal);
}

.priority-badge.low .priority-dot {
  background: var(--priority-low);
  box-shadow: 0 0 8px var(--priority-low);
}

/* Priority section borders */
.subsection.priority-high {
  border-left: 2px solid var(--priority-high);
}

.subsection.priority-normal {
  border-left: 2px solid var(--priority-normal);
}

.subsection.priority-low {
  border-left: 2px solid var(--priority-low);
}

/* Input Fields */
input[type="text"],
textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

textarea {
  resize: vertical;
  min-height: 72px;
}

/* Item Lists */
.item-list {
  list-style: none;
  min-height: 44px;
}

.item-list li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
  border: 1px solid transparent;
  transition: var(--transition);
}

.item-list li:hover {
  border-color: var(--border-color);
  background: var(--bg-hover);
}

.item-list li:last-child {
  margin-bottom: 0;
}

.item-list .item-text {
  flex: 1;
  font-size: 0.85rem;
}

.item-list .issue-number {
  background: var(--accent-primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 0.875rem !important;
  background: transparent !important;
  border: 1px dashed var(--border-hover) !important;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* Input Row */
.input-row {
  display: flex;
  gap: 0.375rem;
  padding: 0.375rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
  border: 1px solid var(--accent-primary);
}

.input-row input {
  padding: 0.5rem 0.625rem;
  font-size: 0.85rem;
}

.input-row input.issue-input {
  max-width: 80px;
  text-align: center;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 0.875rem;
  justify-content: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: var(--transition);
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.preview-hint {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Preview Embeds */
.embed-preview {
  background: #2f3136;
  border-radius: var(--radius-sm);
  margin-bottom: 0.875rem;
  overflow: hidden;
}

.embed-preview:last-child {
  margin-bottom: 0;
}

.embed-content {
  padding: 0.875rem;
  display: flex;
}

.embed-body {
  flex: 1;
}

.embed-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.375rem;
  color: white;
}

.embed-description {
  color: #dcddde;
  margin-bottom: 0.875rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.embed-field {
  margin-bottom: 0.625rem;
}

.embed-field:last-child {
  margin-bottom: 0;
}

.embed-field-name {
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: white;
  font-size: 0.9rem;
}

.embed-field-value {
  color: #dcddde;
  font-size: 0.85rem;
  white-space: pre-line;
  line-height: 1.5;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--error);
}

.toast.info {
  border-left: 3px solid var(--discord-blue);
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .subsection-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .meta-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  main {
    padding: 1rem;
  }

  .input-row {
    flex-wrap: wrap;
  }

  .input-row input.issue-input {
    max-width: none;
    flex: 1;
  }

  #user-name {
    display: none;
  }
}

/* Selection */
::selection {
  background: var(--accent-primary);
  color: white;
}
