/* ==========================================================================
   Minecraft Command Generator - Modern Dark Aesthetic Stylesheet
   ========================================================================== */

:root {
  --bg-main: #0b0f17;
  --bg-card: #131b26;
  --bg-card-hover: #182232;
  --bg-input: #0e141e;
  --bg-modal: #151d2a;
  
  --border-color: #253346;
  --border-focus: #10b981;
  --border-subtle: #1c2838;
  
  --text-main: #f3f4f6;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  
  --accent-redstone: #ef4444;
  --accent-redstone-hover: #dc2626;
  
  --accent-gold: #f59e0b;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(239, 68, 68, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* App Layout */
.app-container {
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 18px var(--accent-emerald-glow);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-client {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Grid System */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
}

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

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-normal);
}

.card:hover {
  border-color: #2f4158;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.header-with-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.card-header-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Form & Inputs */
.command-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.prompt-symbol {
  position: absolute;
  left: 1rem;
  color: var(--accent-emerald);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.25rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

/* Command List */
.command-list-container {
  flex: 1;
  min-height: 380px;
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
}

.command-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  user-select: none;
}

.command-item:hover {
  background-color: var(--bg-card-hover);
  border-color: #2b394d;
}

.command-item.dragging {
  opacity: 0.4;
  border-color: var(--accent-blue);
}

.command-item.drag-over {
  border-top: 2px solid var(--accent-emerald);
}

.command-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

.command-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-main);
  word-break: break-all;
  white-space: pre-wrap;
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.command-item:hover .command-actions {
  opacity: 1;
}

/* Edit Mode */
.command-edit-wrapper {
  display: flex;
  flex: 1;
  gap: 0.4rem;
  align-items: center;
}

.command-edit-input {
  flex: 1;
  background-color: #0b1018;
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.35rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.command-edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Empty State */
.empty-state {
  margin: auto;
  text-align: center;
  padding: 2.5rem 1rem;
  max-width: 380px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.8;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.empty-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Options Bar */
.options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.option-item label {
  color: var(--text-secondary);
}

.input-sm {
  width: 90px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
  text-align: center;
}

.input-sm:focus {
  outline: none;
  border-color: var(--accent-emerald);
}

/* Checkbox Styles */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.checkbox-label input:checked + .custom-checkbox {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

.checkbox-label input:checked + .custom-checkbox::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Output Area */
.output-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-item strong {
  font-family: var(--font-mono);
  color: #fff;
}

.limit-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  margin-left: 0.35rem;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.limit-tag.warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border-color: rgba(245, 158, 11, 0.3);
}

.limit-tag.danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--accent-redstone);
  border-color: rgba(239, 68, 68, 0.3);
}

.code-area-wrapper {
  flex: 1;
  min-height: 240px;
  margin-bottom: 1rem;
  position: relative;
}

.code-area-wrapper textarea {
  width: 100%;
  height: 100%;
  min-height: 240px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-all;
  transition: border-color var(--transition-fast);
}

.code-area-wrapper textarea.no-wrap {
  white-space: pre;
  word-break: normal;
  overflow-x: auto;
}

.code-area-wrapper textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.action-footer {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Guide Accordion */
.guide-box {
  margin-top: 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.guide-box summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.guide-box summary:hover {
  color: var(--text-main);
}

.guide-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.guide-content {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.guide-content ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.guide-content code {
  background-color: var(--bg-card);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: var(--accent-emerald);
  border: 1px solid var(--border-color);
}

.guide-content kbd {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  font-size: 0.75rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.5);
  color: #fff;
}

.guide-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: 2px solid var(--accent-gold);
  padding-left: 0.6rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-blue-hover);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-emerald {
  background-color: var(--accent-emerald);
  color: #fff;
}

.btn-emerald:hover:not(:disabled) {
  background-color: var(--accent-emerald-hover);
  box-shadow: 0 0 14px var(--accent-emerald-glow);
}

.btn-secondary {
  background-color: #1f2937;
  color: #e5e7eb;
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #374151;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: #384a62;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

.btn-ghost:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--accent-redstone);
  border: none;
}

.btn-danger-ghost:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  flex: 1;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-card {
  background-color: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-size: 1.1rem;
  color: #fff;
  font-weight: 600;
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-body textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: vertical;
}

.modal-body textarea:focus {
  outline: none;
  border-color: var(--accent-emerald);
}

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

/* Presets Grid */
.presets-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.preset-card {
  padding: 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-emerald);
  transform: translateY(-2px);
}

.preset-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #fff;
}

.preset-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #1e293b;
  color: #fff;
  border: 1px solid #334155;
  box-shadow: var(--shadow-lg);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2000;
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
  border-color: var(--accent-emerald);
  background: linear-gradient(135deg, #064e3b 0%, #111827 100%);
}

.toast.toast-error {
  border-color: var(--accent-redstone);
  background: linear-gradient(135deg, #7f1d1d 0%, #111827 100%);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.app-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.link-muted {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color var(--transition-fast);
}

.link-muted:hover {
  color: #fff;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: #253346;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #33465e;
}
