:root {
    --text-primary: #1a1c1e;
    --text-secondary: #444746;
    --text-muted: #70757a;
    --border-color: #dee2e6;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --primary-blue: #dc2626;
    /* Đỏ Crimson - Tươi mới */
    --primary-light: #fee2e2;
    --accent-gold: #b8860b;
    /* Vàng kim */
    --accent-light: #fef9c3;
    --link-color: #dc2626;
    --color-male: #0d6efd;
    --color-female: #e83e8c;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 18px;
    background: var(--bg-white);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Simple Navbar */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid transparent;
    padding: 1rem 0;
    transition: all 0.2s ease;
}

/* Standard Header/Navbar */
.header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1020;
    background: var(--bg-white) !important;
    width: 100%;
}

/* Add padding to body on mobile to prevent header from covering content */
body {
    padding-top: 96px;
    /* Adjust according to header height */
}

@media (min-width: 992px) {
    .header {
        position: static !important;
    }

    body {
        padding-top: 0;
    }

    /* Biến Off-canvas thành Navbar thông thường trên Desktop */
    .offcanvas {
        position: static;
        display: flex;
        flex-direction: row;
        width: auto !important;
        height: auto !important;
        visibility: visible !important;
        background-color: transparent !important;
        border: none !important;
        transform: none !important;
        transition: none !important;
    }

    .offcanvas-header {
        display: none;
    }

    .offcanvas-body {
        display: flex;
        padding: 0;
        overflow: visible;
    }
}

/* Tối ưu hóa Offcanvas Mobile */
.offcanvas {
    width: 280px !important;
    transition: transform 0.3s ease-in-out;
}

.navbar.scrolled {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-blue);
    letter-spacing: -0.5px;
}

.navbar-brand:hover {
    color: var(--primary-blue);
    opacity: 0.9;
}

.nav-link {
    color: var(--text-secondary);
    padding: 0.5rem 1rem !important;
    font-size: 15px;
}

.nav-link:hover {
    color: var(--text-primary);
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 15px;
    color: var(--text-secondary);
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.dropdown-item i {
    margin-right: 8px;
}

@media (max-width: 991.98px) {
    .offcanvas .dropdown-menu {
        border: none;
        padding-left: 1.5rem;
        background: transparent;
        box-shadow: none !important;
    }
}

/* Premium Footer */
.footer {
    background: #fff;
    position: relative;
    padding: 6rem 0 3rem;
    margin-top: 6rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background-image:
        radial-gradient(at 0% 100%, rgba(13, 110, 253, 0.03) 0, transparent 40%),
        radial-gradient(at 100% 100%, rgba(220, 38, 38, 0.03) 0, transparent 40%);
}

[data-theme="dark"] .footer {
    background: #1e1f21 !important;
    border-top-color: rgba(255, 255, 255, 0.05);
}

.footer .fw-bold {
    color: var(--text-primary);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 2rem !important;
}

.footer p.small {
    line-height: 1.8;
    color: var(--text-muted);
}

.footer ul li {
    margin-bottom: 12px !important;
}

.footer a {
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: inline-block;
}

.footer a:hover {
    color: var(--primary-blue);
    transform: translateX(4px);
}

/* Common UI Elements */
.result-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.style-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.decorator-btn.active {
    background: #5f6368;
    color: white;
    border-color: #5f6368;
}

.char-btn:hover {
    background: var(--primary-blue);
    color: white;
    transform: scale(1.1);
}

/* Blog Content Styling */
.post-content h2 {
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #202124;
    font-size: 1.5rem;
}

.post-content h3 {
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #3c4043;
    font-size: 1.25rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.post-content p {
    margin-bottom: 1.25rem;
}

.toc-link {
    display: block;
    padding: 0.25rem 0;
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.9rem;
}

.toc-link:hover {
    text-decoration: underline;
}

.toc-h3 {
    padding-left: 1rem;
    color: #5f6368;
}

/* Branding Tool Elements */
.slogan-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 3px solid #22c55e;
}

.suggestion-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.suggestion-card:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, .28);
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: #158e78;
    transform: translateY(-3px);
}

#back-to-top i {
    font-size: 1.2rem;
    line-height: 0;
}

@media (max-width: 767.98px) {
    #back-to-top {
        bottom: 100px;
        right: 20px;
    }
}

/* 404 Page Styling */
.error-page {
    padding: 100px 0;
    text-align: center;
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    color: #e8eaed;
    line-height: 1;
    margin-bottom: 20px;
}

/* ========================
   UX/UI Improvements
   ======================== */

/* Typography Classes */
.text-title {
    color: #202124;
}

.text-link {
    color: var(--primary-blue);
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

/* Card with Hover Effect */
.card-hoverable {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: box-shadow 0.2s ease;
}

.card-hoverable:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, .28);
}

/* Form input styling */
.form-input-rounded {
    border-color: #dadce0;
    padding: 12px 20px;
}

.bg-card {
    background: #fff;
}

[data-theme="dark"] .bg-card {
    background: #292a2d !important;
}

.bg-card-hover {
    background: #fff;
    transition: background 0.2s ease;
}

.bg-card-hover:hover {
    background: #f8f9fa !important;
}

[data-theme="dark"] .bg-card-hover {
    background: #292a2d;
}

[data-theme="dark"] .bg-card-hover:hover {
    background: #3c4043 !important;
}

.transition-all {
    transition: all 0.3s ease-in-out !important;
}

.card-hoverable:hover .category-icon-wrapper {
    background-color: var(--primary-blue) !important;
    color: white !important;
}

.hover-translate:hover {
    transform: translateY(-2px);
}

.category-item {
    border-left: 3px solid transparent !important;
}

.category-item:hover {
    border-left-color: var(--primary-blue) !important;
    padding-left: 1.25rem !important;
    /* Slight shift to the right */
}

/* Focus States for Accessibility */
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-to-content:focus {
    position: fixed;
    top: 10px;
    left: 10px;
    width: auto;
    height: auto;
    padding: 10px 20px;
    background: var(--primary-blue);
    color: white;
    z-index: 9999;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 90px;
    right: 30px;
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.success {
    background: #22c55e;
}

/* Badge Styles */
.badge-male {
    background: rgba(25, 166, 140, 0.1);
    color: #19a68c;
}

.badge-female {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.badge-unisex {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

/* Ý nghĩa tên chi tiết - Markdown Blocks */
.meaning-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.meaning-container>h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-top: 0;
    margin-bottom: 0;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 2px solid var(--primary-blue);
    border-radius: 0.75rem 0.75rem 0 0;
    display: block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.meaning-container>h2+p,
.meaning-container>h2+ul,
.meaning-container>h2+ol,
.meaning-container>h2+h3 {
    margin-top: -1.5rem;
    /* Kéo nội dung lên sát Header */
    padding: 1.5rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    line-height: 1.8;
    color: #4a5568;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Xử lý các đoạn văn tiếp theo trong cùng một khối */
.meaning-container p+p {
    margin-top: 1rem;
}

.meaning-container h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.meaning-container ul,
.meaning-container ol {
    padding-left: 1.5rem;
    margin-bottom: 0;
}

.meaning-container li {
    margin-bottom: 0.5rem;
}

.meaning-container strong {
    color: var(--primary-blue);
}

[data-theme="dark"] .meaning-container>h2 {
    background: #2d2e31;
    border-color: #3c4043;
    color: var(--primary-blue);
}

[data-theme="dark"] .meaning-container>h2+p,
[data-theme="dark"] .meaning-container>h2+ul,
[data-theme="dark"] .meaning-container>h2+ol,
[data-theme="dark"] .meaning-container>h2+h3 {
    background: #2d2e31;
    border-color: #3c4043;
    color: #e8eaed;
}

@media (max-width: 768px) {
    .meaning-container>h2 {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .meaning-container>h2+p,
    .meaning-container>h2+ul,
    .meaning-container>h2+ol,
    .meaning-container>h2+h3 {
        padding: 1rem;
    }
}

/* ========================
   DARK MODE SUPPORT
   ======================== */
[data-theme="dark"] {
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #9aa0a6;
    --border-color: #3c4043;
    --bg-white: #202124;
    --bg-light: #292a2d;
    --primary-blue: #f87171;
    --primary-light: #450a0a;
    --link-color: #f87171;
    --color-male: #8ab4f8;
    --color-female: #ff80ab;
}

[data-theme="dark"] body {
    background: #1a1b1e;
    color: #e8eaed;
}

[data-theme="dark"] .navbar,
[data-theme="dark"] .header {
    background: #202124 !important;
    border-bottom-color: #3c4043;
}

[data-theme="dark"] .footer {
    background: #171717;
    border-top-color: #3c4043;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .card,
[data-theme="dark"] .card-hoverable,
[data-theme="dark"] .bg-card,
[data-theme="dark"] .toc-wrapper,
[data-theme="dark"] .sticky-sidebar .bg-white,
[data-theme="dark"] .skeleton-card,
[data-theme="dark"] .dropdown-menu {
    background: #2d2e32 !important;
}

[data-theme="dark"] .bg-light,
[data-theme="dark"] .toc-header {
    background: #35363a !important;
}

[data-theme="dark"] .bg-white {
    background: #2d2e32 !important;
}

[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] .toc-wrapper,
[data-theme="dark"] .toc-chip,
[data-theme="dark"] .slogan-card,
[data-theme="dark"] .suggestion-card,
[data-theme="dark"] .result-item,
[data-theme="dark"] .name-card {
    border-color: #3c4043 !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-title,
[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] .post-content,
[data-theme="dark"] .score-box-container .text-dark,
[data-theme="dark"] .table {
    color: #e8eaed !important;
    background-color: #2d2e32 !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .toc-link,
[data-theme="dark"] .toc-chip,
[data-theme="dark"] .input-group-text {
    color: #bdc1c6 !important;
}

[data-theme="dark"] .text-link,
[data-theme="dark"] .name-card a {
    color: #8ab4f8 !important;
}

[data-theme="dark"] .btn-link,
[data-theme="dark"] .btn-favorite,
[data-theme="dark"] .btn-compare {
    background: transparent !important;
    border: none !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #adb5bd !important;
    opacity: 1;
}

[data-theme="dark"] option {
    background: #2d2e31;
    color: #e8eaed;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .toc-header:hover,
[data-theme="dark"] .favorite-item:hover,
[data-theme="dark"] .bg-card-hover:hover {
    background: #3c4043 !important;
}

[data-theme="dark"] .horizontal-toc,
[data-theme="dark"] .offcanvas,
[data-theme="dark"] .favorites-panel {
    background: #202124 !important;
}

[data-theme="dark"] .toc-chip:hover {
    background: #35363a;
    border-color: #8ab4f8 !important;
    color: #8ab4f8 !important;
}

[data-theme="dark"] .score-box-container .bg-white,
[data-theme="dark"] .slogan-card,
[data-theme="dark"] .suggestion-card,
[data-theme="dark"] .result-item,
[data-theme="dark"] .favorite-item,
[data-theme="dark"] .bg-card-hover,
[data-theme="dark"] .table {
    background: #2d2e31 !important;
}

[data-theme="dark"] .shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .bg-element-light {
    background: #3c4043;
}

[data-theme="dark"] .bg-numeric-light {
    background: #1e3a5f;
}

[data-theme="dark"] .border-eval {
    background: #2d2e31;
    border-color: #ef4444;
    border-style: dashed;
}

[data-theme="dark"] .btn-name-accent {
    background: #1e3a5f;
    color: #8ab4f8;
    border-color: #3c4043;
}

/* Global Bootstrap Overrides for Dark Mode */
[data-theme="dark"] .accordion-item,
[data-theme="dark"] .list-group-item {
    background: transparent !important;
    color: #e8eaed !important;
}

[data-theme="dark"] .accordion-button {
    background: transparent !important;
    color: #e8eaed !important;
    box-shadow: none !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1) brightness(2);
}

[data-theme="dark"] .list-group-item-action:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #8ab4f8 !important;
}

[data-theme="dark"] .badge.bg-white {
    background-color: #3c4043 !important;
    color: #e8eaed !important;
    border-color: #4d5156 !important;
}

[data-theme="dark"] .page-link {
    background-color: #2d2e31 !important;
    border-color: #3c4043 !important;
    color: #8ab4f8 !important;
}

[data-theme="dark"] .page-item.active .page-link {
    background-color: #1a73e8 !important;
    border-color: #1a73e8 !important;
    color: #fff !important;
}

[data-theme="dark"] .page-item.disabled .page-link {
    background-color: #202124 !important;
    border-color: #3c4043 !important;
    color: #5f6368 !important;
}

[data-theme="dark"] .table {
    border-color: #3c4043 !important;
    color: #bdc1c6;
}

[data-theme="dark"] .table> :not(caption)>*>* {
    background-color: transparent !important;
    border-bottom-color: #3c4043 !important;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: #f8f9fa;
    color: #202124;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

[data-theme="dark"] .theme-toggle {
    background: #3c4043;
    color: #ffd700;
}

@media (max-width: 767.98px) {
    .theme-toggle {
        bottom: 160px;
        right: 20px;
    }
}

/* ========================
   SMOOTH ANIMATIONS
   ======================== */

/* Fade In Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.5s ease forwards;
}

/* Stagger animation for grid items */
.animate-stagger>* {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.animate-stagger>*:nth-child(1) {
    animation-delay: 0.05s;
}

.animate-stagger>*:nth-child(2) {
    animation-delay: 0.1s;
}

.animate-stagger>*:nth-child(3) {
    animation-delay: 0.15s;
}

.animate-stagger>*:nth-child(4) {
    animation-delay: 0.2s;
}

.animate-stagger>*:nth-child(5) {
    animation-delay: 0.25s;
}

.animate-stagger>*:nth-child(6) {
    animation-delay: 0.3s;
}

.animate-stagger>*:nth-child(7) {
    animation-delay: 0.35s;
}

.animate-stagger>*:nth-child(8) {
    animation-delay: 0.4s;
}

/* Enhanced Hover Effects for Cards */
.name-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.name-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12) !important;
}

/* Smooth button press effect */
.btn-favorite:active {
    transform: scale(0.9);
}

/* Link hover underline animation */
.link-animated {
    position: relative;
    text-decoration: none;
}

.link-animated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-blue);
    transition: width 0.3s ease;
}

.link-animated:hover::after {
    width: 100%;
}

/* ========================
   SKELETON LOADING
   ======================== */
@keyframes skeleton-loading {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f2f5 25%, #e2e8f0 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 4px;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2a2a2e 25%, #3a3a3e 50%, #2a2a2e 75%);
    background-size: 200% 100%;
}

.skeleton-name-card {
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.skeleton-title {
    height: 22px;
    width: 65%;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.skeleton-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ========================
   FAVORITES / SHORTLIST
   ======================== */
.btn-favorite {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent !important;
    color: #adb5bd;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    padding: 0;
}

.btn-favorite:hover {
    color: #ff4757;
    transform: scale(1.15);
}

.btn-favorite.active {
    background: transparent !important;
    color: #ff4757 !important;
}

.btn-favorite.active i {
    animation: heartPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.4);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

[data-theme="dark"] .btn-favorite {
    background: transparent !important;
    color: #6c757d;
}

[data-theme="dark"] .btn-favorite.active {
    color: #ff4757 !important;
}

/* Favorites Counter Badge in Navbar */
.favorites-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 0;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-white);
    line-height: 1;
    z-index: 2;
    padding-top: 1px;
    /* Thêm bù để căn giữa theo chiều dọc tốt hơn */
}

.btn-favorites-toggle {
    transition: transform 0.2s ease;
    padding: 0.5rem 0.75rem !important;
}

.btn-favorites-toggle:hover {
    transform: scale(1.1);
}

.btn-favorites-toggle:hover i {
    color: #ff6b81 !important;
}

/* Favorites Dropdown Panel */
.favorites-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.favorites-panel.show {
    right: 0;
}

[data-theme="dark"] .favorites-panel {
    background: #202124;
}

.favorites-panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorites-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.favorites-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
}

.favorites-panel-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .favorites-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.favorites-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.favorites-overlay.show {
    opacity: 1;
    visibility: visible;
}

.favorite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--bg-light);
    transition: background 0.2s ease;
}

.favorite-item:hover {
    background: #e5e7eb;
}

[data-theme="dark"] .favorite-item:hover {
    background: #3c4043;
}

.favorite-item-name {
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.favorite-item-name:hover {
    color: var(--primary-blue);
}

.favorite-item-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #9aa0a6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.favorites-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.favorites-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Favorites nav button */
.nav-favorites {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

@media (max-width: 767.98px) {
    .favorites-panel {
        width: 100%;
        right: -100%;
    }
}

/* ========================
   NAME COMPARISON BAR (FIXED)
   ======================== */
.compare-bar {
    position: fixed;
    bottom: 24px;
    /* Đẩy cao lên khỏi đáy một chút */
    left: 50%;
    transform: translate(-50%, 120%);
    width: auto;
    max-width: 90%;
    min-width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    /* Đảm bảo nổi cao nhất */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 50px;
    /* Bo tròn đều sang trọng */
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    pointer-events: none;
}

.compare-bar.show {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

[data-theme="dark"] .compare-bar {
    background: rgba(45, 46, 49, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.compare-items-list {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.compare-item-chip {
    padding: 0.35rem 0.75rem;
    background: #f1f3f4;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    border: 1px solid transparent;
}

[data-theme="dark"] .compare-item-chip {
    background: #3c4043;
    color: #fff;
}

.compare-item-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.6;
}

.compare-item-remove:hover {
    opacity: 1;
    color: #dc3545;
}

.btn-compare-action {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

#btn-compare-clear,
.btn-compare,
.btn-favorite {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.btn-compare-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.compare-count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 11px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1px;
}

@media (max-width: 767.98px) {
    .compare-bar {
        bottom: 85px;
        /* Tránh đè lên Mobile Footer */
        border-radius: 16px;
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        width: 95%;
    }

    .compare-items-list {
        width: 100%;
        overflow-x: auto;
        justify-content: center;
    }

    .btn-compare-action {
        width: 100%;
        justify-content: center;
    }
}

/* Internal Linking Styling */
.text-link-internal {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-blue);
    transition: all 0.2s;
}

.text-link-internal:hover {
    color: var(--primary-blue);
    background: rgba(220, 38, 38, 0.05);
    border-bottom-style: solid;
}

[data-theme="dark"] .text-link-internal {
    border-bottom-color: #ef4444;
}

/* Comparison Table Styling */
.table thead th:first-child {
    border-top-left-radius: 16px;
}

.table thead th:last-child {
    border-top-right-radius: 16px;
}

.table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 16px;
}

.table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 16px;
}

[data-theme="dark"] .table tbody tr td.bg-light {
    background: #3c4043 !important;
    color: #fff;
}

[data-theme="dark"] .table td {
    border-color: #3c4043 !important;
}

/* ========================
   LIVE SEARCH STYLES
   ======================== */
.search-input-wrapper {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    padding: 8px;
    z-index: 1050;
    display: none;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .search-suggestions {
    background: #2d2e32;
    border-color: #4d5156;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.search-suggestions.show {
    display: block;
    animation: fadeInUp 0.25s ease;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none !important;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: var(--bg-light);
    transform: translateX(4px);
}

[data-theme="dark"] .suggestion-item:hover {
    background: #3c4043;
}

.suggestion-name {
    font-weight: 500;
}

.suggestion-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========================
   ENHANCED SEARCH BAR UI
   ======================== */
.search-input-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-left {
    position: absolute;
    left: 20px;
    color: var(--text-muted);
    font-size: 1.2rem;
    z-index: 5;
    pointer-events: none;
}

/* ========================
   PROFESSIONAL SEARCH FOCUS EFFECT
   ======================== */
.search-group-premium {
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    overflow: hidden;
    display: flex !important;
    align-items: center;
    padding: 4px 6px 4px 12px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.search-group-premium:focus-within {
    border-color: #2563eb;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
}

.search-group-premium .input-group-text {
    background: transparent !important;
    border: none !important;
    padding: 0 8px 0 0 !important;
    color: #94a3b8 !important;
}

.search-group-premium .form-control {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    height: 44px !important;
    padding: 0 10px !important;
    font-size: 0.95rem !important;
}

.search-group-premium .form-select {
    border: none !important;
    border-left: 1px solid #f1f3f4 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    height: 30px !important;
    /* Shorter for better look */
    padding: 0 30px 0 15px !important;
    margin: 0 10px !important;
    color: #475569 !important;
    font-size: 0.9rem !important;
    width: auto !important;
    min-width: 100px;
}

#search-clear {
    width: 32px;
    height: 32px !important;
    display: none;
    /* Controlled by JS */
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #94a3b8;
    border-radius: 50% !important;
    transition: all 0.2s;
    border: none !important;
    background: transparent !important;
    margin: 0 5px;
}

#search-clear:hover {
    background: #f1f3f4 !important;
    color: #1e293b;
}

.search-group-premium .btn-primary {
    border-radius: 50px !important;
    height: 42px !important;
    padding: 0 24px !important;
    font-weight: 600;
    font-size: 0.9rem;
    background-color: #2563eb !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transition: all 0.2s;
}

.search-group-premium .btn-primary:hover {
    background-color: #1d4ed8 !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .search-group-premium {
    background: #1e1f21 !important;
    border-color: #333639 !important;
}

[data-theme="dark"] .search-group-premium .form-select {
    border-left-color: #333639 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .search-group-premium:focus-within {
    border-color: #2563eb !important;
}

/* Custom Scrollbar for Search Suggestions */
#search-suggestions::-webkit-scrollbar {
    width: 6px;
}

#search-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

#search-suggestions::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

#search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Thanh tiến trình đọc (Reading Progress) */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 2000;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #2563eb, #10b981);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

/* Tùy chỉnh TOC Chip Active */
.toc-chip.active {
    background-color: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}



.form-input-premium:focus {
    border-color: var(--primary-blue) !important;
    box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.15) !important;
    background: #fff;
}

.search-clear-btn {
    position: absolute;
    right: 15px;
    background: #f1f3f4;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    z-index: 5;
}

.search-clear-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.search-clear-btn.show {
    display: flex;
}

.btn-search-premium {
    height: 60px;
    padding-left: 35px;
    padding-right: 35px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.25);
    transition: all 0.3s ease;
}

.btn-search-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.35);
}

.btn-search-premium:active {
    transform: translateY(1px);
}

/* Suggestion Highlighting */
.suggestion-highlight {
    color: var(--primary-blue);
    font-weight: 700;
}

.did-you-mean-box {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-light);
    font-size: 13px;
    border-radius: 12px 12px 0 0;
}

.did-you-mean-link {
    color: var(--primary-blue);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 576px) {
    .search-input-container {
        flex-direction: column;
        gap: 12px;
    }

    .form-input-premium {
        height: 52px;
        padding-left: 48px !important;
        border-radius: 16px !important;
    }

    .search-icon-left {
        left: 16px;
        top: 15px;
    }

    .btn-search-premium {
        width: 100%;
        height: 52px;
        border-radius: 16px !important;
        margin-left: 0 !important;
    }

    .search-clear-btn {
        right: 12px;
        top: 12px;
    }
}

/* ========================
   MICRO-INTERACTIONS & POLISH
   ======================== */

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.3);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    60% {
        transform: scale(1);
    }
}

.btn-favorite.active i {
    animation: heartBeat 0.45s ease-in-out;
    color: #ff4757 !important;
}

@keyframes copySuccess {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
        color: #22c55e;
    }

    100% {
        transform: scale(1);
    }
}

.copy-anim {
    animation: copySuccess 0.4s ease-in-out;
}

/* Tối ưu Comparison Bar Mobile */
@media (max-width: 767.98px) {
    .compare-bar {
        left: 10px !important;
        right: 10px !important;
        bottom: 20px !important;
        transform: translateY(120%) !important;
        /* Reset horizontal translate from desktop */
        width: calc(100% - 20px) !important;
        min-width: auto !important;
        max-width: none !important;
        border-radius: 20px !important;
        padding: 15px !important;
        flex-direction: column !important;
        gap: 15px !important;
        height: auto !important;
    }

    .compare-bar.show {
        transform: translateY(0) !important;
    }

    .compare-items-list {
        max-width: 100% !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    .compare-items-list+div {
        width: 100% !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .btn-compare-action {
        width: 100% !important;
        justify-content: center !important;
        border-radius: 50px !important;
        height: 45px !important;
    }

    #btn-compare-clear {
        margin: 0 auto !important;
        padding: 5px 0 !important;
    }
}

/* Push floating buttons up when Compare Bar is open on Mobile */
@media (max-width: 767.98px) {
    body.has-compare-bar #back-to-top {
        bottom: 225px !important;
    }

    body.has-compare-bar .theme-toggle {
        bottom: 285px !important;
    }
}