/* =========================================================
   BASE STYLES & LAYOUT
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  cursor: default;
}

/* Con trỏ dạng tay cho các thành phần click */
a, button, input[type="checkbox"], input[type="button"], 
.btn, .tab-btn, .filter-btn, .interactive, .toggle-label, 
.project-card, .menu-item, .clickable, .theme-toggle-btn, .header-auth-btn {
  cursor: pointer !important;
}

/* Cho phép gõ text */
input[type="text"], input[type="search"], input[type="password"], input[type="url"], input[type="number"], textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
  cursor: text !important;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  line-height: 1.6;
}

body.dark-theme {
  background-color: #292a2d;
}

body:not(.dark-theme) .stars {
  display: none !important;
}

/* =========================================================
   TOP DONATE RUNNING MARQUEE TICKER (THANH CHẠY PHẢI QUA TRÁI)
   ========================================================= */
.top-donate-marquee {
  width: 100%;
  background: rgba(18, 19, 24, 0.92);
  border-bottom: 1px solid rgba(255, 0, 127, 0.3);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  z-index: 9999;
  padding: 6px 0;
  display: flex;
  align-items: center;
}

body:not(.dark-theme) .top-donate-marquee {
  background: #ffffff;
  border-bottom: 1px solid #fbcfe8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.marquee-track {
  display: inline-flex;
  gap: 36px;
  animation: marqueeScroll 35s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

.marquee-item {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.marquee-item .badge-tag {
  background: rgba(255, 0, 127, 0.15);
  color: #ff007f;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
}

.marquee-item .amount-tag {
  color: #28df99;
  font-weight: 700;
}

/* =========================================================
   COMPACT FLOATING AUTH PILL (KHÔNG CHIẾM DẢI MÀN HÌNH)
   ========================================================= */
.admin-bar, .user-bar {
  position: fixed;
  top: 14px;
  right: 16px;
  width: auto;
  padding: 6px 14px;
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.3s ease;
}

.admin-bar {
  background: rgba(18, 19, 24, 0.88);
  border: 1px solid #28df99;
  color: #fff;
}

body:not(.dark-theme) .admin-bar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #059669;
  color: #0f172a;
}

.user-bar {
  background: rgba(18, 19, 24, 0.88);
  border: 1px solid #00f2fe;
  color: #fff;
}

body:not(.dark-theme) .user-bar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #0284c7;
  color: #0f172a;
}

.admin-badge, .user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-height: 24px;
}

.user-badge img,
#user-avatar-img {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.admin-badge { color: #28df99; }
.user-badge { color: #00f2fe; }

.admin-logout-btn {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-logout-btn:hover {
  background: #ff6b6b;
  color: #fff;
}

/* =========================================================
   SIDE FLOATING STICKERS (CHỈ HIỆN KHI Ở NỀN TRẮNG / LIGHT MODE)
   ========================================================= */
body.dark-theme .side-sticker {
  display: none !important;
}

body:not(.dark-theme) .side-sticker {
  display: block;
}

.side-sticker {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 90px;
  height: 90px;
  z-index: 99;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.side-sticker video,
.side-sticker .sticker-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  mix-blend-mode: multiply; /* Tự động xóa sạch nền trắng 100% khi ở nền sáng */
  pointer-events: none;
}

.side-sticker-left {
  left: 20px;
  animation: floatBounceLeft 4s ease-in-out infinite;
}

.side-sticker-right {
  right: 20px;
  animation: floatBounceRight 4s ease-in-out infinite 0.5s;
}

.side-sticker:hover {
  transform: translateY(-50%) scale(1.15) rotate(5deg);
}

.side-sticker-left:hover {
  transform: translateY(-50%) scale(1.15) rotate(-5deg);
}

@keyframes floatBounceLeft {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  50% { transform: translateY(-58%) rotate(-6deg); }
}

@keyframes floatBounceRight {
  0%, 100% { transform: translateY(-50%) rotate(0deg); }
  50% { transform: translateY(-58%) rotate(6deg); }
}

@media (max-width: 1080px) {
  .side-sticker {
    display: none !important;
  }
}

/* =========================================================
   CONTAINER & PROMINENT HEADER AUTH BUTTON
   ========================================================= */
.app-container {
  width: 100%;
  max-width: 740px;
  padding: 16px 20px 80px;
  position: relative;
  z-index: 10;
  margin: 0 auto;
}

.header-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.header-auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(40, 223, 153, 0.12);
  border: 1px solid #28df99;
  border-radius: var(--radius-full);
  color: #28df99;
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 0 10px rgba(40, 223, 153, 0.25);
}

.header-auth-btn:hover {
  background: #28df99;
  color: #121318;
  box-shadow: 0 0 16px rgba(40, 223, 153, 0.5);
  transform: translateY(-2px);
}

.header-auth-btn.logged-in {
  background: rgba(0, 242, 254, 0.12);
  border-color: #00f2fe;
  color: #00f2fe;
}

/* Theme Switch Toggle */
.theme-switch-wrapper {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.theme-checkbox {
  display: none;
}

.theme-toggle-btn {
  width: 38px;
  height: 20px;
  background: #4a4d52;
  border-radius: 30px;
  position: relative;
  display: inline-block;
  transition: background var(--transition-fast);
}

body:not(.dark-theme) .theme-toggle-btn {
  background: #cbd5e1;
}

.theme-toggle-btn::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.theme-checkbox:checked + .theme-toggle-btn {
  background: #28df99;
}

.theme-checkbox:checked + .theme-toggle-btn::after {
  transform: translateX(18px);
}

/* =========================================================
   NAVIGATION TABS
   ========================================================= */
.main-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 22px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.84rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

body:not(.dark-theme) .tab-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

body:not(.dark-theme) .tab-btn:hover {
  background: #f1f5f9;
}

.tab-btn.active {
  background: #28df99;
  color: #121318;
  border-color: #28df99;
  box-shadow: 0 0 15px rgba(40, 223, 153, 0.4);
}

body:not(.dark-theme) .tab-btn.active {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.tab-content-section {
  display: none;
  animation: fadeIn 0.35s ease forwards;
}

.tab-content-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   FOOTER & BOTTOM QUOTES
   ========================================================= */
.donate-bottom-quote {
  text-align: center;
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.donate-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.site-footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Responsive */
@media (max-width: 640px) {
  .app-container {
    padding: 12px 14px 60px;
  }
  .main-tabs {
    gap: 6px;
  }
  .tab-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
  }
  .text {
    font-size: 26px;
  }
}
