/* ============================================
   Mini Apps AI — CSS Design System
   Tone: Trắng hồng dễ thương (White-Pink Cute)
   Font: Quicksand
   ============================================ */

/* CSS Variables — Bảng màu chính */
:root {
  --pink-50: #FFF0F5;
  --pink-100: #FFE4EC;
  --pink-200: #FFC0CB;
  --pink-300: #FFB6C1;
  --pink-400: #FF8FAB;
  --pink-500: #FF6B9D;
  --pink-600: #FF4081;
  --pink-700: #E91E63;

  --white: #FFFFFF;
  --bg: #FFFAFB;
  --text-dark: #2D2D3A;
  --text-medium: #5A5A6E;
  --text-light: #9E9EB0;

  --shadow-soft: 0 2px 16px rgba(255, 107, 157, 0.08);
  --shadow-card: 0 4px 24px rgba(255, 107, 157, 0.1);
  --shadow-hover: 0 8px 32px rgba(255, 107, 157, 0.18);

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============= HEADER ============= */
.header {
  position: relative;
  background: linear-gradient(135deg, var(--white) 0%, var(--pink-50) 50%, var(--pink-100) 100%);
  padding: 48px 0 40px;
  overflow: hidden;
  border-bottom: 1px solid var(--pink-100);
}

.header-bg-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: var(--pink-300);
  top: -100px;
  right: -50px;
  animation: float 8s ease-in-out infinite;
}

.shape-2 {
  width: 200px;
  height: 200px;
  background: var(--pink-200);
  bottom: -80px;
  left: -30px;
  animation: float 6s ease-in-out infinite reverse;
}

.shape-3 {
  width: 120px;
  height: 120px;
  background: var(--pink-400);
  top: 20px;
  left: 40%;
  animation: float 10s ease-in-out infinite 2s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.header-content {
  position: relative;
  text-align: center;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 36px;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  75% { transform: scale(1.1) rotate(5deg); }
}

.logo-text {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pink-500), var(--pink-700));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.header-subtitle {
  font-size: 1rem;
  color: var(--text-medium);
  font-weight: 500;
  max-width: 480px;
  margin: 0 auto;
}

/* ============= BỘ LỌC ============= */
.filter-section {
  padding: 24px 0 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 192, 203, 0.2);
}

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1.5px solid var(--pink-200);
  border-radius: var(--radius-full);
  background: var(--white);
  color: var(--text-medium);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-btn:hover {
  border-color: var(--pink-400);
  color: var(--pink-600);
  background: var(--pink-50);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

.filter-emoji {
  font-size: 1rem;
}

/* ============= GRID ỨNG DỤNG ============= */
.main-content {
  padding: 32px 0 60px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ============= APP CARD ============= */
.app-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
  transition: var(--transition);
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

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

.app-card-inner {
  position: relative;
  background: var(--white);
  border: 1.5px solid var(--pink-100);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  overflow: hidden;
}

.app-card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pink-300), var(--pink-500), var(--pink-300));
  opacity: 0;
  transition: var(--transition);
}

.app-card:hover .app-card-inner {
  border-color: var(--pink-300);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.app-card:hover .app-card-inner::before {
  opacity: 1;
}

.app-emoji {
  font-size: 2.4rem;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pink-50);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.app-card:hover .app-emoji {
  background: var(--pink-100);
  transform: scale(1.08) rotate(-3deg);
}

.app-info {
  flex: 1;
  min-width: 0;
}

.app-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
  line-height: 1.3;
}

.app-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Badges */
.app-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-photo { background: #E8F5E9; color: #2E7D32; }
.badge-video { background: #FFF3E0; color: #E65100; }
.badge-design { background: #E3F2FD; color: #1565C0; }
.badge-creative { background: #F3E5F5; color: #7B1FA2; }
.badge-tool { background: #FFF8E1; color: #F57F17; }
.badge-edu { background: #E0F7FA; color: #00838F; }
.badge-fashion { background: var(--pink-100); color: var(--pink-700); }

/* Mũi tên */
.app-arrow {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 1.2rem;
  color: var(--pink-300);
  transition: var(--transition);
  font-weight: 700;
}

.app-card:hover .app-arrow {
  color: var(--pink-500);
  transform: translateX(4px);
}

/* ============= TRẠNG THÁI TRỐNG ============= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 1rem;
  font-weight: 500;
}

/* ============= FOOTER ============= */
.footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--pink-100);
  background: var(--pink-50);
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 768px) {
  .header {
    padding: 36px 0 28px;
  }

  .logo-text {
    font-size: 1.6rem;
  }

  .logo-icon {
    font-size: 28px;
  }

  .header-subtitle {
    font-size: 0.9rem;
    padding: 0 12px;
  }

  .apps-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-card-inner {
    padding: 18px;
    gap: 14px;
  }

  .app-emoji {
    font-size: 2rem;
    width: 48px;
    height: 48px;
  }

  .filter-bar {
    padding: 0 4px 12px;
  }

  .filter-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 14px;
  }

  .logo-text {
    font-size: 1.4rem;
  }

  .app-name {
    font-size: 0.95rem;
  }

  .app-desc {
    font-size: 0.8rem;
  }
}

/* ============= SCROLLBAR TÙY CHỈNH ============= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--pink-50);
}

::-webkit-scrollbar-thumb {
  background: var(--pink-200);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--pink-400);
}

/* ============= SELECTION ============= */
::selection {
  background: var(--pink-200);
  color: var(--text-dark);
}

/* ============================================
   DARK MODE SYSTEM
   ============================================ */

body.dark {
  --white: #1E1E28;
  --bg: #12121A;
  --text-dark: #F5F5FA;
  --text-medium: #C0C0D0;
  --text-light: #8E8EA0;
  
  --pink-50: #2D1B22;
  --pink-100: #3D222E;
  --pink-200: #5D2D42;
  --pink-300: #7D3855;
  
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 32px rgba(255, 107, 157, 0.25);
}

/* Đảm bảo border và input/button có style phù hợp trong Dark Mode */
body.dark .header {
  background: linear-gradient(135deg, #1E1E28 0%, #2D1B22 50%, #3D222E 100%);
  border-bottom-color: rgba(255, 107, 157, 0.15);
}

body.dark .filter-section {
  background: var(--bg);
  border-bottom-color: rgba(255, 107, 157, 0.15);
}

body.dark .filter-btn {
  background: #1E1E28;
  border-color: rgba(255, 107, 157, 0.25);
  color: var(--text-medium);
}

body.dark .filter-btn:hover {
  background: #2D1B22;
  border-color: var(--pink-400);
  color: var(--pink-400);
}

body.dark .filter-btn.active {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  color: white;
  border-color: transparent;
}

body.dark .footer {
  background: #1E1E28;
  border-top-color: rgba(255, 107, 157, 0.15);
}

body.dark .app-card-inner {
  background: #1E1E28;
  border-color: rgba(255, 107, 157, 0.15);
}

body.dark .app-emoji {
  background: #2D1B22;
}

body.dark .app-card:hover .app-emoji {
  background: #3D222E;
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle-btn {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--white);
  border: 1.5px solid var(--pink-200);
  color: var(--pink-500);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
  z-index: 100;
}

.theme-toggle-btn:hover {
  border-color: var(--pink-400);
  transform: scale(1.08) rotate(15deg);
  box-shadow: var(--shadow-hover);
}

.theme-icon-light {
  display: block;
}

.theme-icon-dark {
  display: none;
}

body.dark .theme-icon-light {
  display: none;
}

body.dark .theme-icon-dark {
  display: block;
}

/* ============================================
   RECENT APPS SECTION
   ============================================ */

.recent-section {
  padding: 8px 0 24px;
  margin-bottom: 24px;
  border-bottom: 1.5px dashed rgba(255, 107, 157, 0.2);
}

body.dark .recent-section {
  border-bottom-color: rgba(255, 107, 157, 0.15);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pink-500);
  margin-bottom: 18px;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.recent-card .app-card-inner {
  padding: 16px;
  border-style: dashed;
  border-color: rgba(255, 107, 157, 0.3);
}

body.dark .recent-card .app-card-inner {
  border-color: rgba(255, 107, 157, 0.25);
}

.recent-card .app-emoji {
  width: 44px;
  height: 44px;
  font-size: 1.8rem;
}

.recent-card .app-name {
  font-size: 0.95rem;
}

.recent-card .app-desc {
  font-size: 0.8rem;
  -webkit-line-clamp: 1;
}

/* Adjust responsive for toggle and grid */
@media (max-width: 768px) {
  .theme-toggle-btn {
    top: -16px;
    right: 12px;
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
  }
  .recent-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

