/* =========================================================
   LIKE A GHOST THEME — adapted from blog.yegge.com
   Dark / Light with glow effects + Google Sans
   ========================================================= */

@font-face {
  font-family: 'Google Sans';
  src: url('../fonts/google-sans/GoogleSans-Regular.woff2') format('woff2'),
       url('../fonts/google-sans/GoogleSans-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Google Sans';
  src: url('../fonts/google-sans/GoogleSans-Medium.woff2') format('woff2'),
       url('../fonts/google-sans/GoogleSans-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Google Sans';
  src: url('../fonts/google-sans/GoogleSans-Bold.woff2') format('woff2'),
       url('../fonts/google-sans/GoogleSans-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Avoid color pop on first paint */
:root {
  color-scheme: light dark;
  --transition: 200ms ease;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;
}

html.theme-ready * {
  transition: background-color var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition);
}

/* ---------------------------
   DARK MODE (default)
   --------------------------- */
.dark-mode {
  --bg:          #000000;
  --bg-2:        #0c0c0c;
  --bg-3:        #141414;
  --text:        #f5f6f8;
  --text-muted:  rgba(245, 246, 248, 0.55);
  --text-rgb:    245, 246, 248;
  --link:        #e6e7ea;
  --border-rgb:  255, 255, 255;
  --border:      rgba(255, 255, 255, 0.08);
  --border-hover:rgba(255, 255, 255, 0.18);
  --glow-text:   0 0 0.6px rgba(245,246,248,0.45), 0 0 8px rgba(245,246,248,0.12);
  --glow-h:      0 0 0.8px rgba(245,246,248,0.55), 0 0 12px rgba(245,246,248,0.16);
  --shadow:      0 2px 16px rgba(0,0,0,0.5);
  --shadow-hover:0 4px 32px rgba(0,0,0,0.7);
  --input-bg:    #0c0c0c;
  --card-bg:     #0c0c0c;
  --danger:      #ef4444;
  --success:     #22c55e;
  --accent:      #f5f6f8;
}

/* ---------------------------
   LIGHT MODE
   --------------------------- */
.light-mode {
  --bg:          #fefefe;
  --bg-2:        #f3f3f3;
  --bg-3:        #ebebeb;
  --text:        #0a0a0a;
  --text-muted:  rgba(10, 10, 10, 0.5);
  --text-rgb:    10, 10, 10;
  --link:        #111111;
  --border-rgb:  0, 0, 0;
  --border:      rgba(0, 0, 0, 0.08);
  --border-hover:rgba(0, 0, 0, 0.2);
  --glow-text:   0 0 0.4px rgba(10,10,10,0.3);
  --glow-h:      0 0 0.6px rgba(10,10,10,0.4);
  --shadow:      0 2px 16px rgba(0,0,0,0.08);
  --shadow-hover:0 4px 24px rgba(0,0,0,0.14);
  --input-bg:    #f3f3f3;
  --card-bg:     #f3f3f3;
  --danger:      #dc2626;
  --success:     #16a34a;
  --accent:      #0a0a0a;
}

/* ---------------------------
   RESET & BASE
   --------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: all var(--transition);
}

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

/* ---------------------------
   GLOW EFFECTS
   --------------------------- */
.dark-mode p,
.dark-mode li,
.dark-mode span:not(.no-glow) {
  text-shadow: var(--glow-text);
}
.dark-mode h1, .dark-mode h2,
.dark-mode h3, .dark-mode h4 {
  text-shadow: var(--glow-h);
}

/* ---------------------------
   SHARED COMPONENTS
   --------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn-primary:hover {
  filter: brightness(0.9);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}

/* Form controls */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition);
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-hover);
  box-shadow: 0 0 0 3px rgba(var(--text-rgb), 0.06);
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}
.form-select {
  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='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 36px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-muted { background: var(--bg-3); color: var(--text-muted); }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--bg-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider {
  background: var(--text);
  border-color: var(--text);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(18px) translateY(-50%);
  background: var(--bg);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(12px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 8px 10px;
  transition: all var(--transition);
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  padding: 4px;
}
.drag-handle:active { cursor: grabbing; }

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 4px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 16px;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }

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