/* ========================================
   Pup File — Global Design System
   ======================================== */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Orange palette */
  --orange-50: #FFF7ED;
  --orange-100: #FFEDD5;
  --orange-200: #FED7AA;
  --orange-300: #FDBA74;
  --orange-400: #FB923C;
  --orange-500: #F97316;
  --orange-600: #EA580C;
  --orange-700: #C2410C;
  --orange-800: #9A3412;
  --orange-900: #7C2D12;

  /* Light mode */
  --bg-primary: #FAFAFA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F4F4F5;
  --border-color: #E4E4E7;
  --border-subtle: #F4F4F5;
  --text-primary: #09090B;
  --text-secondary: #52525B;
  --text-muted: #A1A1AA;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.1);
  --overlay: rgba(0,0,0,0.4);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #09090B;
  --bg-secondary: #141416;
  --bg-tertiary: #1C1C1F;
  --border-color: #27272A;
  --border-subtle: #1F1F23;
  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted: #636369;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.5);
  --overlay: rgba(0,0,0,0.6);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; }
h5, h6 { font-weight: 600; }

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* --- Typography --- */
.text-xs { font-size: 0.75rem; line-height: 1.4; }
.text-sm { font-size: 0.85rem; line-height: 1.5; }
.text-base { font-size: 0.935rem; line-height: 1.55; }
.text-lg { font-size: 1.1rem; line-height: 1.5; }
.text-xl { font-size: 1.3rem; line-height: 1.4; }
.text-2xl { font-size: 1.65rem; line-height: 1.3; }
.text-3xl { font-size: 2rem; line-height: 1.2; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-orange { color: var(--orange-500); }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.hidden { display: none !important; }
.block { display: block; }
.inline-flex { display: inline-flex; }

.text-center { text-center: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--orange-600);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-700); }
.btn-primary:active { background: var(--orange-800); }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--border-color);
}

.btn-ghost {
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-outline {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.btn-outline:hover {
  border-color: var(--orange-500);
  color: var(--orange-600);
}

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

.btn-lg {
  padding: 12px 28px;
  font-size: 0.95rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--bg-tertiary); }

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* --- Cards --- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* --- Inputs --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
}

.input-field:focus {
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

.input-field::placeholder {
  color: var(--text-muted);
}

select.input-field {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input-field {
  resize: vertical;
  min-height: 80px;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-orange {
  background: var(--orange-100);
  color: var(--orange-700);
}
[data-theme="dark"] .badge-orange {
  background: rgba(249,115,22,0.15);
  color: var(--orange-400);
}

.badge-gray {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideInRight 0.3s ease;
  min-width: 260px;
  max-width: 380px;
}

.toast.success { border-left: 3px solid #22c55e; }
.toast.error { border-left: 3px solid #ef4444; }
.toast.info { border-left: 3px solid var(--orange-500); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- Dark Mode Toggle --- */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.theme-toggle:hover {
  background: var(--bg-tertiary);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
}

/* --- Sidebar --- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  z-index: 950;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
  padding: var(--space-3) var(--space-3);
  flex: 1;
}

.sidebar-nav .nav-section-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 12px 4px;
  pointer-events: none;
}

.sidebar-nav .nav-section-label:first-child {
  padding-top: 4px;
}

.sidebar-nav a,
.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  text-align: left;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: var(--orange-50);
  color: var(--orange-600);
}
[data-theme="dark"] .sidebar-nav a.active {
  background: rgba(249,115,22,0.1);
  color: var(--orange-400);
}

.sidebar-nav svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-color);
}

/* --- Navbar (Top) --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.navbar-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--orange-600);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.navbar-links a {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.navbar-links a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.menu-toggle:hover { background: var(--bg-tertiary); }
.menu-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-primary);
  fill: none;
  stroke-width: 2;
}

/* --- Section --- */
.section {
  padding: var(--space-16) 0;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-600);
  margin-bottom: var(--space-2);
}

[data-theme="dark"] .section-label { color: var(--orange-400); }

.section-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.6;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--border-color);
  width: 100%;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Pulse animation --- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* --- Skeleton --- */
.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  animation: pulse 1.5s ease-in-out infinite;
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: var(--space-4);
}
.empty-state h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-state p {
  font-size: 0.85rem;
  max-width: 280px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .menu-toggle { display: flex; }
  .hide-mobile { display: none !important; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .section { padding: var(--space-10) 0; }
  .section-title { font-size: 1.35rem; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* --- Utility --- */
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

/* --- Toggle Switch --- */
.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--border-color);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.toggle-switch.active {
  background: var(--orange-500);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--transition-fast);
}
.toggle-switch.active::after {
  transform: translateX(18px);
}

/* --- Support FAB --- */
.support-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--orange-600);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(234,88,12,0.35);
  transition: all 0.2s;
  z-index: 500;
}
.support-fab:hover {
  background: var(--orange-700);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(234,88,12,0.4);
}
.support-fab svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
