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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f4f5f7;
}

/* ============================================================
   App Layout
   ============================================================ */
#app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Header
   ============================================================ */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #1e1e2e;
  color: #cdd6f4;
  border-bottom: 2px solid #313244;
  gap: 12px;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  color: #cba6f7;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.header-actions button {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid #585b70;
  color: #cdd6f4;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.header-actions button:hover {
  background: rgba(205, 214, 244, 0.1);
  border-color: #89b4fa;
}

/* Hide file input */
#file-input {
  display: none;
}

/* ============================================================
   Main Layout
   ============================================================ */
#main {
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

/* ============================================================
   Symbol List Panel (Left)
   ============================================================ */
#symbol-list-panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e0e2e8;
  overflow: hidden;
}

#search-input {
  margin: 12px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  flex-shrink: 0;
  color: #333;
}

#search-input:focus {
  border-color: #89b4fa;
  box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.25);
}

#symbol-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 10px 10px;
}

#symbol-list li {
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  background: #fff;
  color: #374151;
  transition: background 0.1s, border-color 0.1s;
  word-break: break-all;
}

#symbol-list li:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

#symbol-list li.active {
  background: #dbeafe;
  border-color: #93c5fd;
  font-weight: 500;
  color: #1d4ed8;
}

/* ============================================================
   Editor Panel (Right)
   ============================================================ */
#editor-panel {
  overflow-y: auto;
  padding: 28px 32px;
  background: #f9fafb;
}

/* Placeholder */
#editor-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9ca3af;
  font-size: 15px;
  text-align: center;
}

/* Editor form (hidden by default via JS) */
#editor-form {
  display: none;
  max-width: 560px;
}

/* Form card (bordered container around fields) */
.form-card {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

/* ============================================================
   Form
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-group > label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7280;
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: #111827;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  border-color: #89b4fa;
  box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.25);
}

.form-group input[readonly] {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Checkbox label */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #374151;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #4f86e8;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 10px;
}

/* Primary button (Save) */
.btn-primary {
  padding: 7px 18px;
  background: #4f86e8;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #3b72d4;
}

/* Danger button */
.btn-danger {
  padding: 7px 18px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Validation error state */
.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

/* Field-level error message */
.field-error-msg {
  display: none;
  margin-top: 4px;
  font-size: 11px;
  color: #ef4444;
}

.field-error-msg.visible {
  display: block;
}

/* ============================================================
   Notification Toast
   ============================================================ */
@keyframes slideInFromRight {
  from {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(calc(100% + 24px));
    opacity: 0;
  }
}

#notification {
  display: none;
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 300;
  background: #fff;
  border-left: 4px solid #22c55e;
  border-radius: 4px;
  padding: 12px 18px;
  font-size: 13px;
  color: #111827;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  pointer-events: none;
}

#notification.show {
  display: block;
  animation: slideInFromRight 0.3s ease forwards;
}

#notification.hide {
  display: block;
  animation: slideOutToRight 0.3s ease forwards;
}

/* ============================================================
   Modal
   ============================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  padding: 28px;
  width: 500px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111827;
}

.modal-content p {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 14px;
}

.modal-content textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  margin-bottom: 18px;
  color: #111827;
}

.modal-content textarea:focus {
  border-color: #89b4fa;
  box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.25);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#btn-bulk-cancel {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
}

#btn-bulk-cancel:hover {
  background: #f9fafb;
}

#btn-bulk-confirm {
  background: #4f86e8;
  border: none;
  color: #fff;
}

#btn-bulk-confirm:hover {
  background: #3b72d4;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  #main {
    grid-template-columns: 1fr;
    grid-template-rows: 220px 1fr;
  }

  #symbol-list-panel {
    border-right: none;
    border-bottom: 1px solid #e0e2e8;
  }

  #editor-panel {
    padding: 20px 16px;
  }

  .modal-content {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  #header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
