:root {
  --github-bg-dark: #0d1117;
  --github-bg-lighter: #161b22;
  --github-border: #30363d;
  --github-text: #c9d1d9;
  --github-text-muted: #8b949e;
  --github-accent-blue: #58a6ff;
  --github-accent-green: #2ea043;
  --github-accent-red: #da3633;
  --glass-bg: rgba(22, 27, 34, 0.7);
  --glass-border: rgba(48, 54, 61, 0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(135deg, var(--github-bg-dark), var(--github-bg-lighter));
  color: var(--github-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
}

/* Header */
header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--github-border);
  background: var(--github-bg-dark);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-container i {
  font-size: 1.5rem;
  color: var(--github-text);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--github-border);
  background-color: var(--github-bg-lighter);
  color: var(--github-text);
}

.btn:hover {
  background-color: #30363d;
  border-color: #8b949e;
}

.btn-primary {
  background-color: var(--github-accent-green);
  color: #ffffff;
  border-color: rgba(240, 246, 252, 0.1);
}

.btn-primary:hover {
  background-color: #2c974b;
  border-color: rgba(240, 246, 252, 0.1);
}

.btn-outline {
  background-color: transparent;
  color: var(--github-accent-blue);
  border-color: var(--github-border);
}

.btn-outline:hover {
  border-color: var(--github-accent-blue);
  background-color: rgba(88, 166, 255, 0.1);
}

/* Main Layout */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 73px);
}

/* Sidebar */
.sidebar {
  width: 300px;
  border-right: 1px solid var(--github-border);
  display: flex;
  flex-direction: column;
  background: var(--github-bg-dark);
  height: 100%;
}

.sidebar-header {
  padding: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--github-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.add-section-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--github-bg-dark);
  border: 1px solid var(--github-border);
  border-radius: 6px;
  width: 200px;
  box-shadow: 0 8px 24px rgba(1, 4, 9, 1);
  display: none;
  z-index: 1000;
}

.dropdown-menu.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--github-text);
}

.dropdown-item:hover {
  background-color: var(--github-accent-blue);
  color: #fff;
}

.section-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--github-bg-lighter);
  border: 1px solid var(--github-border);
  border-radius: 6px;
  cursor: grab;
  transition: border-color 0.2s;
}

.section-item:active {
  cursor: grabbing;
}

.section-item.active {
  border-color: var(--github-accent-blue);
  background: rgba(88, 166, 255, 0.1);
}

.section-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.drag-handle {
  color: var(--github-text-muted);
  cursor: grab;
}

.section-actions {
  display: flex;
  gap: 0.5rem;
}

.section-actions button {
  background: none;
  border: none;
  color: var(--github-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.section-actions button:hover {
  color: var(--github-text);
  background: var(--github-border);
}

.section-actions .delete-btn:hover {
  color: var(--github-accent-red);
}

.section-content {
  display: none;
}

.section-list-item {
  display: flex;
  flex-direction: column;
}


/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: 100%;
}

.split-left {
  flex: 1;
  border-right: 1px solid var(--github-border);
  overflow-y: auto;
}

.split-right {
  flex: 1;
  overflow-y: auto;
  background-color: var(--github-bg-dark);
}

/* Editor Panel */
.editor-panel {
  padding: 1.5rem;
}

.editor-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--github-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background-color: var(--github-bg-dark);
  border: 1px solid var(--github-border);
  border-radius: 6px;
  color: var(--github-text);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--github-accent-blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* Checkbox specific styles */
.checkbox-group {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.checkbox-group label {
  margin-bottom: 0;
}


.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--github-accent-blue);
}

/* Dynamic Forms */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dynamic-list-item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.dynamic-list-item .form-control {
  flex: 1;
}

/* Technologies Grid */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tech-category {
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--github-text-muted);
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--github-bg-dark);
  border: 1px solid var(--github-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.tech-item:hover {
  background-color: var(--github-border);
}

.tech-item.selected {
  border-color: var(--github-accent-blue);
  background-color: rgba(88, 166, 255, 0.1);
  color: var(--github-accent-blue);
}

.tech-item i {
  font-size: 1.25rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--github-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--github-border);
}

/* Preview Panel */
.preview-panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--github-border);
}

.tabs {
  display: flex;
  gap: 1rem;
}

.tab {
  background: none;
  border: none;
  color: var(--github-text-muted);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: var(--github-text);
}

.tab.active {
  color: var(--github-text);
  border-bottom-color: #f78166; /* GitHub Tab Highlight indicator */
}

.preview-content {
  flex: 1;
  background-color: var(--github-bg-dark);
  border: 1px solid var(--github-border);
  border-radius: 6px;
  padding: 2rem;
  overflow-y: auto;
  position: relative;
}

.copy-btn-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--github-bg-lighter);
  border: 1px solid var(--github-border);
  color: var(--github-text);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  display: none;
}

.copy-btn-overlay:hover {
  background: var(--github-border);
}

/* Markdown Styles inside Preview */
.markdown-body {
  box-sizing: border-box;
  min-width: 200px;
  max-width: 980px;
  margin: 0 auto;
  padding: 0;
  color: var(--github-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  word-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.markdown-body h1 {
  font-size: 2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--github-border);
}

.markdown-body h2 {
  font-size: 1.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--github-border);
}

.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre,
.markdown-body details {
  margin-top: 0;
  margin-bottom: 16px;
}

.markdown-body img {
  max-width: 100%;
  box-sizing: content-box;
  background-color: transparent;
}

.markdown-body a {
  color: var(--github-accent-blue);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

#code-preview {
  display: none;
  background-color: var(--github-bg-dark);
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
  font-size: 0.875rem;
  color: #e6edf3;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--github-bg-lighter);
  border: 1px solid var(--github-border);
  color: var(--github-text);
  padding: 1rem 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(0);
}

.toast i {
  color: var(--github-accent-green);
}

/* Sortable clone style */
.sortable-ghost {
  opacity: 0.4;
  background-color: var(--github-bg-dark);
}

.sortable-drag {
  background-color: var(--github-bg-lighter);
  border-color: var(--github-accent-blue);
  cursor: grabbing !important;
  box-shadow: 0 8px 24px rgba(1, 4, 9, 1);
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--github-border);
  border-radius: 4px;
}

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