/* XPDevs Design System - design.md */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --text: #1f1f1f;
  --sidebar: #f0f4f9;
  --content-bg: #ffffff;
  --input-bg: #f0f4f9;
  --border: #dee2e6;
  --primary: #1a73e8;
  --user-msg-bg: #f0f4f9;
  --active-item: #e2e7ed;
  --modal-bg: #ffffff;

  --font: "Inter", "Segoe UI", Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 22px;
  --radius-4xl: 24px;
  --radius-5xl: 25px;
  --radius-6xl: 28px;
  --radius-full: 32px;
  --radius-full-mobile: 40px;
  --radius-circle: 50%;
  --shadow-modal: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-dropdown: 0 10px 25px rgba(0,0,0,0.2);
  --shadow-help: 0 8px 30px rgba(0,0,0,0.3);
  --shadow-input-mobile: 0 2px 10px rgba(0,0,0,0.05);
  --shadow-input-mobile-focus: 0 4px 15px rgba(0,0,0,0.1);
  --shadow-mobile-sidebar: 2px 0 10px rgba(0,0,0,0.2);
}

body.dark {
  --bg: #131314;
  --text: #e3e3e3;
  --sidebar: #1e1f20;
  --content-bg: #131314;
  --input-bg: #1e1f20;
  --border: #444746;
  --primary: #1a73e8;
  --user-msg-bg: #282a2c;
  --active-item: #333537;
  --modal-bg: #1e1f20;
}

html { font-size: 16px; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* === Topbar === */
.topbar {
  position: sticky;
  top: 0;
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--content-bg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}
.topbar-brand a {
  display: flex;
  align-items: center;
}
.topbar-brand img {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  object-fit: contain;
}
.topbar-center {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topbar-link {
  padding: 8px 16px;
  border-radius: var(--radius-4xl);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s ease;
  white-space: nowrap;
}
.topbar-link:hover { background: var(--active-item); text-decoration: none; }
.topbar-link.active { background: var(--active-item); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-circle);
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
}
.hamburger:hover { background: rgba(128,128,128,0.1); }
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger span + span { margin-top: 5px; }
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile sidebar (hidden on desktop) */
.mobile-nav { display: none; }

/* Mobile sidebar backdrop (desktop-hidden) */
.mobile-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
}
.mobile-nav-backdrop.open {
  display: block;
}

/* Dropdown (topbar) */
.topbar .dropdown { position: relative; }
.topbar .dropdown-content {
  display: none;
  position: absolute;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  min-width: 180px;
  box-shadow: var(--shadow-dropdown);
  border-radius: var(--radius-xl);
  z-index: 1000;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 0;
}
.topbar .dropdown:hover .dropdown-content { display: block; }
.topbar .dropdown-content a {
  color: var(--text);
  padding: 8px 16px;
  text-decoration: none;
  display: block;
  font-size: 14px;
  text-align: left;
}
.topbar .dropdown-content a:hover { background: var(--active-item); color: var(--primary); text-decoration: none; }

/* === Hero === */
.hero-center {
  text-align: center;
  padding: 80px 24px 40px;
}
.hero-center h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px;
}
@media (max-width: 768px) {
  .hero-center h1 { font-size: 1.3rem; }
}
.hero-center p {
  font-size: 16px;
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0.9;
}

/* === Content Container === */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}
.content-box {
  width: 100%;
  max-width: 800px;
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* === Buttons === */
.btn {
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-2xl);
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
  cursor: pointer;
  transition: filter 0.2s ease;
  font-family: var(--font);
}
.btn:hover { filter: brightness(0.9); text-decoration: none; }

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

.btn-icon {
  background: transparent;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.btn-icon:hover { background: rgba(128,128,128,0.1); opacity: 1; }

/* === Cards === */
.card {
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-4xl);
  padding: 24px;
  margin-bottom: 16px;
}

/* === Footer === */
.site-footer {
  background: var(--sidebar);
  color: var(--text);
  padding: 40px 0;
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.site-footer .footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}
.site-footer .footer-col {
  flex: 1;
  min-width: 150px;
  margin-bottom: 20px;
}
.site-footer .footer-col h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 9px;
  opacity: 0.8;
}
.site-footer .footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-footer .footer-col ul li { margin-bottom: 9px; }
.site-footer .footer-col ul li a {
  color: var(--text);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.site-footer .footer-col ul li a:hover { opacity: 1; text-decoration: underline; }
.site-footer .footer-bottom {
  margin-top: 34px;
  padding: 20px 24px 0;
  border-top: 1px solid var(--border);
  opacity: 0.7;
}
.site-footer .footer-legal {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: 980px;
  margin: 0 auto;
}
.site-footer .legal-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer .legal-links li:not(:last-child)::after {
  content: "|";
  margin-left: 10px;
  color: var(--border);
}
.site-footer .legal-links a { color: var(--text); text-decoration: none; opacity: 0.7; }
.site-footer .legal-links a:hover { opacity: 1; text-decoration: underline; }

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: var(--modal-bg);
  padding: 30px;
  border-radius: var(--radius-6xl);
  min-width: 320px;
  max-width: 90%;
  box-shadow: var(--shadow-modal);
}
.modal-content h3 {
  margin: 0 0 15px;
  font-size: 1.3rem;
  font-weight: 700;
}
.modal-content p {
  margin: 0 0 20px;
  line-height: 1.6;
  opacity: 0.9;
}
.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.modal-actions .cancel {
  padding: 10px 20px;
  border-radius: var(--radius-2xl);
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
}
.modal-actions .confirm {
  padding: 10px 20px;
  border-radius: var(--radius-2xl);
  font-weight: 500;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}

/* === Dropdown (generic) === */
.dropdown-menu {
  position: absolute;
  right: 12px;
  top: 45px;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dropdown);
  padding: 6px;
  min-width: 150px;
  z-index: 1000;
}
.dropdown-menu button {
  background: transparent;
  border: none;
  padding: 12px 16px;
  width: 100%;
  text-align: left;
  border-radius: var(--radius-lg);
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
}
.dropdown-menu button:hover { background: var(--active-item); }
.dropdown-menu .delete-opt { color: #ff4d4d; }

/* === Toggle === */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  border-radius: var(--radius-4xl);
  transition: 0.3s;
}
.toggle .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: var(--radius-circle);
  transition: 0.3s;
}
.toggle input:checked + .slider { background-color: var(--primary); }
.toggle input:checked + .slider:before { transform: translateX(24px); }

/* === Spinner === */
.spinner {
  width: 32px;
  height: 32px;
  overflow: visible;
}
.spinner circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 6px;
  stroke-linecap: round;
}
.spinner-sm { width: 20px; height: 20px; }
.spinner-lg { width: 48px; height: 48px; }
.spinner-primary { color: var(--primary); }
.spinner-white { color: #ffffff; }
.spinner-text { color: var(--text); }
.spinner-error { color: #ff4d4d; }

/* === List Item === */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: var(--radius-4xl);
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.list-item:hover { background: rgba(0,0,0,0.05); }
body.dark .list-item:hover { background: rgba(255,255,255,0.05); }
.list-item.active { background: var(--active-item); }
.list-item .item-title { font-size: 1.2rem; font-weight: 500; }

/* === Help Icon === */
.help-icon {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-circle);
  background: rgba(26,115,232,0.15);
  color: var(--primary);
  font-size: 11px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.help-icon:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

/* === Help Overlay === */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
}
.help-overlay.show { display: flex; }
.help-overlay-content {
  background: var(--modal-bg);
  padding: 30px;
  border-radius: var(--radius-2xl);
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-help);
  text-align: center;
}
.help-overlay-content h3 {
  margin: 0 0 15px;
  color: var(--primary);
  font-size: 1.3rem;
}
.help-overlay-content p {
  margin: 0 0 20px;
  line-height: 1.6;
  opacity: 0.9;
}
.help-overlay-close {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 30px;
  border-radius: var(--radius-2xl);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: filter 0.2s ease;
}
.help-overlay-close:hover { filter: brightness(0.9); }

/* === Input === */
.input-container {
  max-width: 800px;
  padding: 0 20px 24px 20px;
  margin: 0 auto;
}
.input-area {
  background: var(--input-bg);
  border-radius: var(--radius-full);
  padding: 6px 12px 6px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, border 0.2s;
}
.input-area:focus-within {
  background: var(--bg);
  border: 1px solid var(--border);
}
.input-area input {
  flex: 1;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 16px;
  outline: none;
  color: var(--text);
  font-family: var(--font);
}
.input-area input::placeholder { color: var(--text); opacity: 0.5; }

/* === Content Warning === */
.content-warning {
  font-size: 12px;
  text-align: center;
  margin-top: 12px;
  color: #70757a;
}

/* === Search Input === */
.search-input-wrapper {
  position: relative;
}
.search-input-wrapper input {
  padding: 8px 32px 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  color: var(--text);
  font-family: var(--font);
}
.search-input-wrapper input:focus {
  border-color: var(--primary);
}
.search-icon-overlay {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* === Account Profile === */
.account-profile {
  text-align: center;
  margin: 20px 0 30px;
}
.account-profile .avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-circle);
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  margin: 0 auto 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-profile h3 { margin: 0; font-size: 1.5rem; font-weight: 700; }

/* === Section === */
section { padding: 60px 0; }
.section { margin-bottom: 40px; }

/* === Responsive === */
@media (max-width: 768px) {
  .topbar-center { display: none; }
  .hamburger { display: flex; }
  .topbar { flex-wrap: nowrap; height: 64px; padding: 0 16px; }
  .topbar-brand { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
  .topbar-actions { margin-left: auto; }
  .mobile-nav {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 0;
  }
  .mobile-nav.open {
    transform: translateX(0);
  }
  .mobile-nav ul {
    flex-direction: column;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
  }
  .mobile-nav ul li { width: 100%; }
  .mobile-nav ul li a {
    display: block;
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-md);
  }
  .mobile-nav ul li a:hover { background: var(--active-item); text-decoration: none; }
  .topbar .dropdown-content {
    position: static;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0 0 0 16px;
    background: transparent;
    border: none;
  }
  .hero-center { padding: 40px 16px 24px; }
  .container { padding: 0 16px; }
  section { padding: 32px 0; }
  .site-footer .footer-col { flex-basis: 50%; }
  .site-footer .footer-legal { flex-direction: column; align-items: flex-start; }
}
