:root {
  --bg: #0a0a0a; /* neutral-950 */
  --bg-secondary: #171717; /* neutral-900 */
  --border: #262626; /* neutral-800 */
  --border-hover: #525252; /* neutral-500 */
  --text: #e5e5e5; /* neutral-200 */
  --text-muted: #a3a3a3; /* neutral-400 */
  --text-dim: #737373; /* neutral-500 */
  --highlight: #e5e5e5;

  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --font-mono: SFMono-Regular, "JetBrains Mono", Consolas, monospace;
  --radius: 8px;
  --transition: all 0.3s ease-out;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  selection-background-color: #262626;
  selection-color: #fff;
}

.bg-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    rgba(23, 23, 23, 0.4),
    var(--bg) 60%
  );
}

.container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 24px;
}

#theme-select {
  padding: 8px 16px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  transition: var(--transition);
}

@media (min-width: 1024px) {
  .layout-grid {
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
  }
}

/* LEFT PANEL: Headers */
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-top: 40px;
}

header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
}

@media (min-width: 768px) {
  header h1 {
    font-size: 60px;
  }
}

.text-dim {
  color: var(--text-dim);
}

header h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 500px;
}

.highlight {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-dim);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
}

/* FORM */
.capture-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  text-transform: lowercase;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
}

input[type="url"] {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: var(--transition);
}

input[type="url"]:focus {
  outline: none;
  border-color: var(--border-hover);
}

input[type="url"]::placeholder {
  color: #404040;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

/* Checkbox toggle */
.custom-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  color: var(--text-dim);
}

.checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.check-icon {
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition);
  color: #10b981; /* emerald-500 */
}

.custom-toggle.active .checkbox {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.custom-toggle.active .check-icon {
  opacity: 1;
  transform: scale(1);
}

.custom-toggle .toggle-text {
  font-size: 14px;
  font-weight: 500;
  text-transform: lowercase;
  transition: color 0.3s;
}

.custom-toggle:hover .toggle-text {
  color: var(--text-muted);
}
.custom-toggle.active .toggle-text {
  color: #10b981;
}

/* Theme Dropdown */
.theme-dropdown {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  text-transform: lowercase;
}

.theme-dropdown:hover,
.theme-dropdown:focus {
  border-color: var(--border-hover);
  color: var(--text-muted);
}

.theme-dropdown option {
  background: var(--bg);
  color: var(--text);
}

/* Submit Button */
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: #000;
  background: var(--text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

@media (min-width: 768px) {
  button[type="submit"] {
    width: auto;
  }
}

button[type="submit"]:hover {
  background: #fff;
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-icon {
  transition: transform 0.3s ease;
}

button[type="submit"]:hover:not(:disabled) .send-icon {
  transform: translateX(2px);
}

/* RIGHT PANEL: History */
.right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

@media (min-width: 1024px) {
  .right-panel {
    padding-top: 80px;
  }
}

.history-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 32px;
}

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

.history-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4d4d4; /* neutral-300 */
}

.history-title span {
  font-weight: 500;
  font-size: 14px;
  text-transform: lowercase;
}

#history-count {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.history-list-wrapper {
  background: rgba(10, 10, 10, 0.5);
  border: 1px solid var(--bg-secondary);
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.history-item {
  border-bottom: 1px solid var(--bg-secondary);
  transition: background 0.2s;
  animation: slideIn 0.3s ease both;
  display: flex;
  align-items: stretch;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: rgba(23, 23, 23, 0.5); /* neutral-900/50 */
}

.history-item a {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  gap: 16px;
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0 16px 0 8px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-btn:hover {
  color: #f87171; /* red-400 */
}

.history-item .filename {
  font-size: 12px;
  font-family: var(--font-mono);
  color: #d4d4d4; /* neutral-300 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item .url {
  display: none; /* Hide URL to keep it cleaner */
}

.history-item .date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  white-space: nowrap;
}

.empty-msg {
  color: var(--text-dim);
  font-size: 14px;
  padding: 32px;
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.page-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-info {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

/* Toasts */
.temp-msg {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.success-msg {
  border-color: rgba(16, 185, 129, 0.3);
}

.error-msg {
  color: #f87171;
  background: rgba(127, 29, 29, 0.1);
  border-color: rgba(127, 29, 29, 0.3);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
