/* ==========================
   Biến màu cho 3 theme
   ========================== */

/* Theme mặc định (sáng) */
:root {
    --bg-body: #f5f5f7;
    --bg-elevated: #ffffff;
    --bg-soft: #eef0ff;

    --border-subtle: rgba(0, 0, 0, 0.06);

    --text-main: #111827;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;

    --accent: #4f46e5;
    --accent-soft: #e0e7ff;
    --accent-strong: #3730a3;

    --danger: #ef4444;

    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
    --radius-lg: 18px;
    --radius-xl: 26px;
}

/* Theme tối */
[data-theme="dark"] {
    --bg-body: #020617;
    --bg-elevated: #020617;
    --bg-soft: #111827;

    --border-subtle: rgba(148, 163, 184, 0.25);

    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --text-soft: #6b7280;

    --accent: #6366f1;
    --accent-soft: rgba(79, 70, 229, 0.16);
    --accent-strong: #818cf8;

    --danger: #fca5a5;

    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.7);
}

/* Theme pastel (nhẹ, thiên về mobile-friendly) */
[data-theme="pastel"] {
    --bg-body: #fff7fb;
    --bg-elevated: #ffffff;
    --bg-soft: #fdf2ff;

    --border-subtle: rgba(236, 72, 153, 0.18);

    --text-main: #312e81;
    --text-muted: #6d28d9;
    --text-soft: #a855f7;

    --accent: #ec4899;
    --accent-soft: #fce7f3;
    --accent-strong: #db2777;

    --danger: #fb7185;

    --shadow-soft: 0 22px 50px rgba(244, 114, 182, 0.45);
}

/* ==========================
   Cơ bản
   ========================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ==========================
   Header
   ========================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(18px);
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.72), transparent);
    color: #e5e7eb;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge,
.brand-badge-link .brand-badge {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    background: radial-gradient(circle at 0 0, #22c55e, #2563eb 40%, #a855f7 75%);
    color: #f9fafb;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.7);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 18px;
    margin: 0;
}

.brand-subtitle {
    margin: 0;
    font-size: 12px;
    color: #9ca3af;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================
   Buttons
   ========================== */

.btn-primary,
.btn-outline,
.btn-ghost {
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s ease-out;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #f9fafb;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 40px rgba(79, 70, 229, 0.45);
}

.btn-outline {
    border-color: rgba(148, 163, 184, 0.6);
    color: var(--text-main);
    background-color: rgba(15, 23, 42, 0.02);
}

.btn-outline:hover {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

.btn-ghost {
    border-color: rgba(148, 163, 184, 0.3);
    color: #e5e7eb;
    background-color: rgba(15, 23, 42, 0.24);
}

.btn-ghost:hover {
    border-color: #e5e7eb;
}

/* ==========================
   Hero
   ========================== */

.hero {
    padding: 32px 0 18px;
}

.hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.8fr);
    gap: 24px;
    align-items: center;
}

.hero-text h2 {
    font-size: 28px;
    margin: 0 0 12px;
}

.hero-text p {
    margin: 0 0 18px;
    color: var(--text-muted);
    max-width: 480px;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hero-panel {
    display: flex;
    justify-content: flex-end;
}

.hero-card {
    background: radial-gradient(circle at 0 0, rgba(129, 140, 248, 0.6), rgba(15, 23, 42, 0.9));
    color: #e5e7eb;
    border-radius: var(--radius-xl);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-soft);
    max-width: 360px;
}

.hero-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c7d2fe;
    margin: 0 0 6px;
}

.hero-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.hero-desc {
    margin: 0 0 12px;
    font-size: 13px;
    color: #cbd5f5;
}

.hero-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #e5e7eb;
}

/* ==========================
   Sections
   ========================== */

.section {
    padding: 8px 0 26px;
}

.section-header {
    margin-bottom: 10px;
}

.section-header h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.section-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* ==========================
   Grid + Cards
   ========================== */

.grid {
    display: grid;
    gap: 14px;
}

.cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 14px 14px 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, border-color 0.12s ease-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.16);
    border-color: var(--accent-soft);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.card-title {
    margin: 0;
    font-size: 15px;
}

.card-badge {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 999px;
    background-color: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid rgba(129, 140, 248, 0.4);
}

.card-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-soft);
}

/* ==========================
   Topic page
   ========================== */

.topic-header {
    margin-bottom: 12px;
}

.topic-header h2 {
    margin: 4px 0;
    font-size: 20px;
}

.topic-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.topic-meta {
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 12px;
}

.topic-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-item {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-elevated);
}

.topic-item-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
}

.topic-item-body {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.topic-item-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
}

.topic-item-tag {
    padding: 2px 6px;
    border-radius: 999px;
    background-color: var(--bg-soft);
    color: var(--text-soft);
}

/* ==========================
   Toolbar, input, select
   ========================== */

.topics-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.input,
.select {
    font-size: 13px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    outline: none;
    background-color: rgba(15, 23, 42, 0.01);
}

.input:focus,
.select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

/* ==========================
   Empty state
   ========================== */

.empty-state {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px dashed var(--border-subtle);
    font-size: 13px;
    color: var(--text-muted);
    background-color: var(--bg-soft);
}

.hidden {
    display: none !important;
}

/* ==========================
   Footer
   ========================== */

.site-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.3);
    padding: 12px 0 16px;
    margin-top: 8px;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-soft);
}

.footer-brand {
    font-weight: 600;
}

.footer-link-back {
    font-size: 13px;
    color: var(--accent-strong);
}

/* ==========================
   Responsive
   ========================== */

@media (max-width: 768px) {
    .hero-inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-panel {
        justify-content: flex-start;
    }

    .hero-card {
        max-width: 100%;
    }

    .site-header .header-inner {
        padding: 10px 0;
    }

    .brand-title {
        font-size: 16px;
    }

    .brand-subtitle {
        display: none;
    }
}
