/* ==========================================================================
   VisionCourse - Apple Design System & Minimalist Specifications
   Based on Apple Human Interface Guidelines & Frontend Design Restraint
   ========================================================================== */

:root {
  --bg-page: #fafafc;
  --bg-elevated: #ffffff;
  --bg-translucent: rgba(255, 255, 255, 0.78);
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-focus: rgba(0, 113, 227, 0.35);

  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --text-accent: #0071e3;
  --text-accent-hover: #0077ed;

  --accent-blue: #0071e3;
  --accent-blue-hover: #0077ed;
  --accent-blue-subtle: rgba(0, 113, 227, 0.08);

  --radius-media: 14px;
  --radius-control: 8px;
  --radius-pill: 9999px;

  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08);

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Segoe UI", sans-serif;
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.18s var(--ease-spring);
  --transition-medium: 0.28s var(--ease-spring);
}

[data-theme="dark"] {
  --bg-page: #000000;
  --bg-elevated: #161617;
  --bg-translucent: rgba(22, 22, 23, 0.82);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(41, 151, 255, 0.45);

  --text-main: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-subtle: #6e6e73;
  --text-accent: #2997ff;
  --text-accent-hover: #47a3ff;

  --accent-blue: #2997ff;
  --accent-blue-hover: #47a3ff;
  --accent-blue-subtle: rgba(41, 151, 255, 0.15);

  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.97);
  transition: transform 80ms ease-out;
}

input, textarea, select {
  font-family: inherit;
  outline: none;
}

/* ================= Minimal Top Header ================= */
/* Requirement: Only keep search bar in center and theme toggle on the right */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--bg-translucent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.header-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 60px;
  box-sizing: border-box;
}

/* Left placeholder to balance flex center */
.header-left-space {
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
}

/* Center Search Bar (Minimalist Apple Style) */
.header-center-search {
  flex: 1;
  max-width: 580px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  transition: all var(--transition-fast);
}

[data-theme="dark"] .search-box {
  background: rgba(255, 255, 255, 0.08);
}

.search-box:focus-within {
  background: var(--bg-elevated);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.search-icon {
  width: 15px;
  height: 15px;
  color: var(--text-subtle);
  margin-right: 10px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-main);
}

.search-input::placeholder {
  color: var(--text-subtle);
}

.search-clear {
  color: var(--text-subtle);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 50%;
  display: none;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--text-main);
}

/* Right Theme Switch Button */
.header-right-tools {
  min-width: 80px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

/* ================= Global Toast ================= */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 32px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: var(--shadow-hover);
  animation: toastIn 0.24s var(--ease-spring) forwards;
  max-width: 400px;
}

.toast.toast-success { border-left: 3px solid #34c759; }
.toast.toast-error { border-left: 3px solid #ff3b30; }
.toast.toast-info { border-left: 3px solid var(--accent-blue); }

@keyframes toastIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.97); }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-media);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
  position: relative;
  padding: 24px;
  transform: scale(0.98);
  transition: transform var(--transition-medium);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--border-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    padding: 10px 16px;
  }
}

/* ================= Unified Button Design Specification ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btn:active {
  transform: scale(0.97) !important;
  transition: transform 80ms ease-out !important;
}

/* Tier 1: Primary Action Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-blue);
  color: #ffffff;
  border: 1px solid transparent;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.28);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.36);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.97) !important;
}

/* Tier 2: Secondary Action Capsule Button (Apple Styled) */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid rgba(0, 0, 0, 0.14);
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

[data-theme="dark"] .btn-secondary {
  background: #232326;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-secondary svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btn-secondary:hover {
  background: #f5f5f7;
  border-color: rgba(0, 0, 0, 0.24);
  color: var(--text-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-secondary:hover {
  background: #2c2c30;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.btn-secondary:active {
  transform: scale(0.97) !important;
}

/* Tier 3: Danger / Delete Button */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.22);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.btn-danger:hover {
  background: #ff3b30;
  color: #ffffff;
  border-color: #ff3b30;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
  transform: translateY(-1px);
}

.btn-danger:active {
  transform: scale(0.97) !important;
}
