/* ============================================
   COMPONENTS — Reusable UI Patterns
   Source of truth: specs/03_design_system.md
   
   Mọi template-part chỉ dùng class ở đây.
   Đổi 1 rule = đồng bộ cả site.
   ============================================ */

/* ═══════════════════════════════════════════
   SECTIONS — Tonal Layering (5.4)
   Xen kẽ: surface → elevated → surface → ...
   Auto-alternating via nth-child — immune to
   hidden sections (stats-bar toggle, etc.)
   ═══════════════════════════════════════════ */
.section--surface    { background: #ffffff; }
.section--elevated   { background: var(--color-surface-container, #e6eeff); }
.section--recessed   { background: var(--color-surface-container-low, #f3f3fd); }
.section--container  { background: var(--color-surface-container, #e6eeff); }
.section--cta {
    background: linear-gradient(135deg, var(--color-primary, #003594), var(--color-primary-container, #004ac6));
    color: var(--color-on-primary, #ffffff);
}

/* Auto-alternating: odd = white, even = tinted
   Skip hero (1st child) and CTA (last child) */
#main-content > section:nth-of-type(odd) { background: #ffffff; }
#main-content > section:nth-of-type(even) { background: var(--color-surface-container, #e6eeff); }

/* Exceptions — these always keep their own style */
#main-content > section.cta-section,
#main-content > section.section--cta { background: linear-gradient(135deg, var(--color-primary, #003594), var(--color-primary-container, #004ac6)); color: var(--color-on-primary, #ffffff); }

/* Dynamic FAQ card colors matching alternating backgrounds */
#main-content > section:nth-of-type(odd) .faq-preview__item {
    background: var(--color-surface-container-low, #f3f3fd);
}
#main-content > section:nth-of-type(odd) .faq-preview__item.hover-bg:hover {
    background: #ffffff;
}
#main-content > section:nth-of-type(even) .faq-preview__item {
    background: #ffffff;
}
#main-content > section:nth-of-type(even) .faq-preview__item.hover-bg:hover {
    background: var(--color-surface-container-low, #f3f3fd);
}
#main-content > section .faq-preview__item.active {
    background: #ffffff !important;
    box-shadow: 0 8px 30px rgba(0, 53, 148, 0.08) !important;
}

/* Section padding */
.section        { padding: 96px 0; }
.section--sm    { padding: 48px 0; }
.section--lg    { padding: 128px 0; }

/* ═══════════════════════════════════════════
   CARDS (5.3)
   Rule: NO border. Hover = shadow only.
   ═══════════════════════════════════════════ */
.card {
    background: var(--color-surface-container-low, #f3f3fd);
    padding: var(--space-xl, 32px);
    border-radius: var(--radius-md, 16px);
    box-shadow: 0 2px 40px rgba(18, 28, 42, 0.03);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 60px rgba(18, 28, 42, 0.05);
}

/* Card lift — subtle hover lift */
.card-lift {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.card-lift:hover {
    box-shadow: 0 4px 60px rgba(18, 28, 42, 0.05);
    transform: translateY(-2px);
}

/* Recommended/featured card */
.card--featured {
    border: 4px solid var(--color-primary, #003594);
    transform: scale(1.05);
    box-shadow: 0 8px 60px rgba(18, 28, 42, 0.08);
    position: relative;
}

/* White card (on colored bg) */
.card--white {
    background: #ffffff;
}

/* Quote card (testimonials) */
.card--quote {
    background: #ffffff;
    position: relative;
}

/* ═══════════════════════════════════════════
   ICON WRAPPERS
   Consistent icon containers
   ═══════════════════════════════════════════ */
.icon-wrap {
    width: 64px;
    height: 64px;
    background: #ffffff;
    border-radius: var(--radius-md, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary, #003594);
    flex-shrink: 0;
}

.icon-wrap .material-symbols-outlined {
    font-size: 2rem;
}

/* Round icon (for process steps, etc) */
.icon-wrap--round {
    border-radius: 50%;
    width: 80px;
    height: 80px;
}

/* Outline style (not filled) */
.icon-wrap--outline {
    background: transparent;
    border: 2px solid var(--color-primary-container, #004ac6);
    color: var(--color-primary-container, #004ac6);
}

/* Hover: fill */
.icon-wrap--hover-fill {
    transition: all 0.3s ease;
}
.icon-wrap--hover-fill:hover,
*:hover > .icon-wrap--hover-fill {
    background: var(--color-primary-container, #004ac6);
    color: #ffffff;
    border-color: var(--color-primary-container, #004ac6);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 74, 198, 0.25);
}

/* ═══════════════════════════════════════════
   BADGES & PILLS
   ═══════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: var(--radius-full, 9999px);
    font-size: 0.8125rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.badge--primary, .badge-primary {
    background: var(--color-surface-container, #e6eeff);
    color: var(--color-primary, #003594);
}

.badge--blue, .badge-blue {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge--before {
    background: #dc2626;
    color: #ffffff;
    font-size: 0.625rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge--after {
    background: var(--color-primary, #003594);
    color: #ffffff;
    font-size: 0.625rem;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Area pills */
.area-pill {
    padding: 12px 24px;
    border-radius: var(--radius-full, 9999px);
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.area-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 53, 148, 0.15);
}

.area-pill--primary {
    background: #eff6ff;
    color: var(--color-primary, #003594);
}

.area-pill--neutral {
    background: var(--color-surface-container, #e6eeff);
    color: var(--color-on-surface-variant, #434654);
}

/* License tag */
.license-tag {
    background: #ffffff;
    padding: 16px;
    border-radius: var(--radius-sm, 8px);
    text-align: center;
    box-shadow: 0 2px 40px rgba(18, 28, 42, 0.03);
    transition: box-shadow 0.3s ease;
}

.license-tag:hover {
    box-shadow: 0 4px 60px rgba(18, 28, 42, 0.05);
}

/* ═══════════════════════════════════════════
   BUTTONS (5.2)
   ═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--radius-full, 9999px);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.125rem;
    padding: 14px 30px;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn:hover  { transform: scale(1.02); }
.btn:active { transform: scale(0.98); }

.btn--cta, .btn-cta {
    background: var(--color-cta-orange, #fea619);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(254, 166, 25, 0.2);
}

.btn--line, .btn-line {
    background: var(--color-line-green, #06C755);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(6, 199, 85, 0.2);
}

.btn--primary, .btn-primary {
    background: var(--color-primary, #003594);
    color: #ffffff;
}

.btn--outline, .btn-outline {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

.btn--outline:hover, .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn--nav, .btn-nav {
    background: var(--color-primary, #003594);
    color: #ffffff;
    padding: 10px 24px;
    font-size: 0.875rem;
}

.btn--sm, .btn-sm {
    padding: 10px 20px;
    font-size: 0.875rem;
}

/* ═══════════════════════════════════════════
   STARS (for testimonials)
   ═══════════════════════════════════════════ */
.stars {
    display: flex;
    gap: 2px;
    color: #facc15;
    margin-bottom: 16px;
}

.stars .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    font-size: 1.25rem;
}

/* ═══════════════════════════════════════════
   GLASSMORPHISM (5.1)
   ═══════════════════════════════════════════ */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

/* ═══════════════════════════════════════════
   GRIDS
   ═══════════════════════════════════════════ */
.grid       { display: grid; gap: var(--space-lg, 24px); }
.grid--2, .grid-2 { grid-template-columns: 1fr; }
.grid--3, .grid-3 { grid-template-columns: 1fr; }
.grid--4, .grid-4 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
    .grid--2, .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid--3, .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid--4, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .grid--3, .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid--4, .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ═══════════════════════════════════════════
   STATS
   ═══════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    text-align: center;
}

@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat__number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-primary, #003594);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.stat__label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-on-surface-variant, #434654);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ═══════════════════════════════════════════
   ANIMATIONS — Scroll Reveal
   ═══════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.4s; opacity: 1; transform: none; }

/* Floating mascot */
.mascot-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

/* Typing cursor */
.typing-cursor {
    border-right: 2px solid var(--color-primary, #003594);
    padding-right: 2px;
}

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

/* Bounce */
.bounce { animation: bounce 3s ease-in-out infinite; }

/* ═══════════════════════════════════════════
   CTA SECTION
   ═══════════════════════════════════════════ */
.cta-section {
    background: linear-gradient(135deg, var(--color-primary, #003594), var(--color-primary-container, #004ac6));
    padding: 96px 24px;
    position: relative;
    overflow: hidden;
}

/* Decorative blobs */
.cta-section::before,
.cta-section::after {
    content: '';
    position: absolute;
    width: 384px;
    height: 384px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    filter: blur(60px);
}

.cta-section::before { top: -192px; right: -192px; }
.cta-section::after  { bottom: -192px; left: -192px; }

/* ═══════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════ */
.container   { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }
.mb-sm  { margin-bottom: 8px; }
.mb-md  { margin-bottom: 16px; }
.mb-lg  { margin-bottom: 24px; }
.mb-xl  { margin-bottom: 32px; }
.mb-2xl { margin-bottom: 48px; }
.mb-3xl { margin-bottom: 64px; }

@media (min-width: 768px) {
    .md-show { display: block; }
    .mobile-only { display: none; }
}

@media (max-width: 767px) {
    .md-show { display: none; }
}
