/* Glossary Frontend Styles */
.glossary-term {
    cursor: help;
    text-decoration: underline dashed #3498db;
    text-underline-offset: 2px;
    position: relative;
    transition: all 0.3s ease;
}

.glossary-term:hover {
    text-decoration-color: #1a73e8;
    color: #1a73e8;
}

.glossary-tooltip {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10000;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

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

.glossary-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #2c3e50;
}

.glossary-tooltip p {
    margin: 0 0 10px 0;
}

.glossary-tooltip .code-example {
    background: #f8f9fa;
    border-left: 3px solid #3498db;
    padding: 8px;
    margin-top: 10px;
    font-family: inherit;
    white-space: pre-wrap;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .glossary-tooltip {
        background: #333;
        border-color: #555;
        color: #f1f1f1;
    }
    
    .glossary-tooltip h4 {
        color: #f8f9fa;
    }
    
    .glossary-tooltip .code-example {
        background: #222;
        border-color: #3498db;
        color: #f1f1f1;
    }
    
    .glossary-term {
        text-decoration-color: #1abc9c;
    }

    .glossary-modal li  {
        color: #f1f1f1;
    }
}


/* =============== MODAL STYLES =============== */
.glossary-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.glossary-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    animation: fadeIn 0.3s ease forwards;
}

.glossary-modal .modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 80%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Hiệu ứng scale nhẹ khi mở */
    transform-origin: center bottom;
}

.glossary-modal.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
    animation: modalAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalAppear {
    0% {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    50% {
        transform: translateY(-10px) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.glossary-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 300;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.glossary-modal.active .modal-close {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.glossary-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* =============== TOOLTIP CONTENT STYLES =============== */
.tooltip-content {
    padding: 40px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.glossary-modal.active .tooltip-content {
    opacity: 1;
    transform: translateY(20px) !important;
    transition-delay: 0.15s;
}

.tooltip-content h4 {
    font-size: 28px;
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .tooltip-content h4 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.25s;
}

.tooltip-content h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: #3498db;
    border-radius: 2px;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: all 0.4s ease;
}

.glossary-modal.active .tooltip-content h4::after {
    opacity: 1;
    transform: scaleX(1);
    transition-delay: 0.35s;
}

.tooltip-content p {
    font-family: 'Inter Display', Sans-Serif;
    line-height: 27.5px;
    color: #555;
    text-align: left;
    font-size: 1.6rem;
    font-weight: 400;
    text-transform: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .tooltip-content p {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.code-example {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
    border-left: 4px solid #3498db;
    overflow-x: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .code-example {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.45s;
}

.code-example pre {
    margin: 0;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: #2c3e50;
}

.term-categories {
    font-family: 'Inter Display', Sans-Serif !important;
    display: flex;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .term-categories {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

.term-categories strong {
    font-size: 16px;
    color: #7f8c8d;
    margin-right: 10px;
    font-weight: 700;
}

.term-categories .category-tag {
    background: #e1f0fa;
    color: #3498db;
    padding: 5px 32px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-right: 8px;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
}

.glossary-modal.active .category-tag {
    opacity: 1;
    transform: translateY(0);
}

/* =============== ANIMATIONS =============== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

/* =============== DARK MODE =============== */
@media (prefers-color-scheme: dark) {
    .glossary-modal .modal-content {
        background: #1e1f2b;
    }

    .tooltip-content h4 {
        color: #f0f0f0;
    }

    .tooltip-content h4::after {
        background: #1abc9c;
    }

    .tooltip-content p {
        color: #c5c8d9;
        
    }

    .code-example {
        background: #252836;
        border-left-color: #1abc9c;
    }

    .code-example pre {
        color: #e0e0ff;
    }

    .term-categories {
        border-top-color: #34374d;
    }

    .term-categories strong {
        color: #a0a3c0;
    }

    .term-categories .category-tag {
        background: rgba(26, 188, 156, 0.15);
        color: #1abc9c;
    }

    .glossary-modal .modal-close {
        background: rgba(30, 31, 43, 0.7);
        color: #a0a3c0;
    }
}

/* =============== RESPONSIVE =============== */
@media (max-width: 768px) {
    .tooltip-content {
        padding: 25px;
    }

    .tooltip-content h4 {
        font-size: 24px;
    }

    .tooltip-content p {
        font-size: 16px;
    }

    .code-example {
        padding: 15px;
    }

    .code-example pre {
        font-size: 14px;
    }
    
    .glossary-modal .modal-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .glossary-modal .modal-content {
        width: 95%;
        max-height: 90vh;
        max-width: 95%;
    }

    .tooltip-content {
        padding: 20px;
    }

    .tooltip-content h4 {
        font-size: 22px;
    }
    
    .glossary-modal .modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (min-width: 0px) and (max-width: 739px) {
    .glossary-modal .modal-content {
        max-width: calc(-60px + 100vw);
        max-height: calc(-225px + 100vh);
        padding-bottom: 70px;
    }

    .tooltip-content {
        transform: translateY(0) !important;
    }

    .glossary-modal .modal-close{
        top: 15px;
    }
}
/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading-spinner svg {
    width: 50px;
    height: 50px;
    animation: rotate 1.4s linear infinite;
}

.loading-spinner circle {
    stroke: #3498db;
    stroke-dasharray: 80px, 200px;
    stroke-dashoffset: 0;
    animation: dash 1.4s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1px, 200px; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -15px; }
    100% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -125px; }
}

/* =============== TERM STYLES =============== */
.glossary-term {
    cursor: help;
    position: relative;
    color: inherit; /* Giữ màu chữ gốc */
    
    /* Giải pháp đa nền tảng cho gạch chân */
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: #3498db;
    text-decoration-skip-ink: none; /* Quan trọng cho mobile */
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    
    /* Fallback cho trình duyệt cũ */
    border-bottom: 1px dashed #3498db;
    padding-bottom: 1px;
    display: inline; /* Chỉ áp dụng cho inline elements */
}

/* Loại bỏ border-bottom khi text-decoration được hỗ trợ đầy đủ */
@supports (text-decoration-style: dashed) {
    .glossary-term {
        border-bottom: none;
        padding-bottom: 0;
    }
}

/* Mobile-specific styles */
.glossary-term {
    cursor: help;
    position: relative;
    text-decoration: none; 
    display: inline; 
    font-weight: 500;
}

.glossary-term::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 1px;
    border-bottom: 3.5px solid #3498db;
    border-radius: 2px;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.glossary-term:hover::after {
    opacity: 1;
    border-color: #1a73e8;
}

/* Ngăn chặn scroll khi modal mở */
body.glossary-modal-open {
    overflow: hidden;
    height: 100%;
}

/* Modal container */
.glossary-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 9999;
}

/* Modal content - cho phép scroll */
.modal-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

.glossary-modal li{
    font-family: 'Inter Display', Sans-Serif;
    line-height: 27.5px;
    color: #555;
    text-align: left;
    font-size: 1.6rem;
    font-weight: 400;
    text-transform: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active li {
    opacity: 1;
    transform: translateY(0);
}

.glossary-modal li + li {
    margin-top: 10px;
}

/* Animation delays for list items */
.glossary-modal.active li:nth-child(1) { transition-delay: 0.3s; }
.glossary-modal.active li:nth-child(2) { transition-delay: 0.35s; }
.glossary-modal.active li:nth-child(3) { transition-delay: 0.4s; }
.glossary-modal.active li:nth-child(4) { transition-delay: 0.45s; }
.glossary-modal.active li:nth-child(5) { transition-delay: 0.5s; }
.glossary-modal.active li:nth-child(6) { transition-delay: 0.55s; }
.glossary-modal.active li:nth-child(7) { transition-delay: 0.6s; }


/* Glossary Frontend Styles */
.glossary-term {
    cursor: help;
    position: relative;
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: #3498db;
    text-decoration-skip-ink: none;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    display: inline;
}

@supports (text-decoration-style: dashed) {
    .glossary-term {
        border-bottom: none;
        padding-bottom: 0;
    }
}

.glossary-tooltip {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10000;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

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

/* =============== MODAL STYLES =============== */
.glossary-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.glossary-modal.active {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.3s ease forwards;
}

.glossary-modal .modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 80%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glossary-modal.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.glossary-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 300;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.glossary-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* =============== TOOLTIP CONTENT STYLES =============== */
.tooltip-content {
    padding: 40px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

/* =============== ANIMATIONS =============== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Bubble effect */
.click-bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9998;
    animation: bubble-anim 0.5s ease-out forwards;
}

@keyframes bubble-anim {
    0% {
        transform: translate(-50%, -50%) scale(0.1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(20);
        opacity: 0;
    }
}

/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading-spinner svg {
    width: 50px;
    height: 50px;
    animation: rotate 1.4s linear infinite;
}

.loading-spinner circle {
    stroke: #3498db;
    stroke-dasharray: 80px, 200px;
    stroke-dashoffset: 0;
    animation: dash 1.4s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1px, 200px; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -15px; }
    100% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -125px; }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .glossary-tooltip {
        background: #333;
        border-color: #555;
        color: #f1f1f1;
    }
    
    .glossary-term {
        text-decoration-color: #1abc9c;
    }
    
    .glossary-modal .modal-content {
        background: #1e1f2b;
    }
    
    .glossary-modal .modal-close {
        background: rgba(30, 31, 43, 0.7);
        color: #a0a3c0;
    }
}

/* =============== RESPONSIVE =============== */
@media (max-width: 768px) {
    .tooltip-content {
        padding: 25px;
    }
    
    .glossary-modal .modal-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .tooltip-content {
        padding: 20px;
    }
    
    .glossary-modal .modal-content {
        max-width: 95%;
        max-height: 90vh;
    }
}

/* Prevent scrolling when modal open */
body.glossary-modal-open {
    overflow: hidden;
    height: 100%;
}


/* Glossary Frontend Styles */
.glossary-term {
    cursor: help;
    text-decoration: underline dashed #3498db;
    text-underline-offset: 2px;
    position: relative;
    transition: all 0.3s ease;
}

.glossary-term:hover {
    text-decoration-color: #1a73e8;
    color: #1a73e8;
}

.glossary-tooltip {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10000;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

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

.glossary-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #2c3e50;
}

.glossary-tooltip p {
    margin: 0 0 10px 0;
}

.glossary-tooltip .code-example {
    background: #f8f9fa;
    border-left: 3px solid #3498db;
    padding: 8px;
    margin-top: 10px;
    font-family: inherit;
    white-space: pre-wrap;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .glossary-tooltip {
        background: #333;
        border-color: #555;
        color: #f1f1f1;
    }
    
    .glossary-tooltip h4 {
        color: #f8f9fa;
    }
    
    .glossary-tooltip .code-example {
        background: #222;
        border-color: #3498db;
        color: #f1f1f1;
    }
    
    .glossary-term {
        text-decoration-color: #1abc9c;
    }

    .glossary-modal li  {
        color: #f1f1f1;
    }
}


/* =============== MODAL STYLES =============== */
.glossary-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.glossary-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    animation: fadeIn 0.3s ease forwards;
}

.glossary-modal .modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 80%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Hiệu ứng scale nhẹ khi mở */
    transform-origin: center bottom;
}

.glossary-modal.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
    animation: modalAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalAppear {
    0% {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    50% {
        transform: translateY(-10px) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.glossary-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 300;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.glossary-modal.active .modal-close {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

.glossary-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* =============== TOOLTIP CONTENT STYLES =============== */
.tooltip-content {
    padding: 40px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.glossary-modal.active .tooltip-content {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

.tooltip-content h4 {
    font-size: 28px;
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .tooltip-content h4 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.25s;
}

.tooltip-content h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: #3498db;
    border-radius: 2px;
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: all 0.4s ease;
}

.glossary-modal.active .tooltip-content h4::after {
    opacity: 1;
    transform: scaleX(1);
    transition-delay: 0.35s;
}

.tooltip-content p {
    font-family: 'Inter Display', Sans-Serif;
    line-height: 27.5px;
    color: #555;
    text-align: left;
    font-size: 1.6rem;
    font-weight: 400;
    text-transform: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .tooltip-content p {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.code-example {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 25px 0;
    border-left: 4px solid #3498db;
    overflow-x: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .code-example {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.45s;
}

.code-example pre {
    margin: 0;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: #2c3e50;
}

.term-categories {
    font-family: 'Inter Display', Sans-Serif !important;
    display: flex;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active .term-categories {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

.term-categories strong {
    font-size: 16px;
    color: #7f8c8d;
    margin-right: 10px;
    font-weight: 700;
}

.term-categories .category-tag {
    background: #e1f0fa;
    color: #3498db;
    padding: 5px 32px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-right: 8px;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
}

.glossary-modal.active .category-tag {
    opacity: 1;
    transform: translateY(0);
}

/* =============== ANIMATIONS =============== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

/* =============== DARK MODE =============== */
@media (prefers-color-scheme: dark) {
    .glossary-modal .modal-content {
        background: #1e1f2b;
    }

    .tooltip-content h4 {
        color: #f0f0f0;
    }

    .tooltip-content h4::after {
        background: #1abc9c;
    }

    .tooltip-content p {
        color: #c5c8d9;
        
    }

    .code-example {
        background: #252836;
        border-left-color: #1abc9c;
    }

    .code-example pre {
        color: #e0e0ff;
    }

    .term-categories {
        border-top-color: #34374d;
    }

    .term-categories strong {
        color: #a0a3c0;
    }

    .term-categories .category-tag {
        background: rgba(26, 188, 156, 0.15);
        color: #1abc9c;
    }

    .glossary-modal .modal-close {
        background: rgba(30, 31, 43, 0.7);
        color: #a0a3c0;
    }
}

/* =============== RESPONSIVE =============== */
@media (max-width: 768px) {
    .tooltip-content {
        padding: 25px;
    }

    .tooltip-content h4 {
        font-size: 24px;
    }

    .tooltip-content p {
        font-size: 16px;
    }

    .code-example {
        padding: 15px;
    }

    .code-example pre {
        font-size: 14px;
    }
    
    .glossary-modal .modal-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .glossary-modal .modal-content {
        width: 95%;
        max-height: 90vh;
        max-width: 95%;
    }

    .tooltip-content {
        padding: 20px;
    }

    .tooltip-content h4 {
        font-size: 22px;
    }
    
    .glossary-modal .modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (min-width: 0px) and (max-width: 739px) {
    .glossary-modal .modal-content {
        max-width: calc(-60px + 100vw);
        max-height: calc(-225px + 100vh);
        padding-bottom: 70px;
    }

    .tooltip-content {
        transform: translateY(0) !important;
    }

    .glossary-modal .modal-close{
        top: 15px;
    }
}
/* Loading spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading-spinner svg {
    width: 50px;
    height: 50px;
    animation: rotate 1.4s linear infinite;
}

.loading-spinner circle {
    stroke: #3498db;
    stroke-dasharray: 80px, 200px;
    stroke-dashoffset: 0;
    animation: dash 1.4s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% { stroke-dasharray: 1px, 200px; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -15px; }
    100% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -125px; }
}

/* =============== TERM STYLES =============== */
.glossary-term {
    cursor: help;
    position: relative;
    color: inherit; /* Giữ màu chữ gốc */
    
    /* Giải pháp đa nền tảng cho gạch chân */
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: #3498db;
    text-decoration-skip-ink: none; /* Quan trọng cho mobile */
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    
    /* Fallback cho trình duyệt cũ */
    border-bottom: 1px dashed #3498db;
    padding-bottom: 1px;
    display: inline; /* Chỉ áp dụng cho inline elements */
}

/* Loại bỏ border-bottom khi text-decoration được hỗ trợ đầy đủ */
@supports (text-decoration-style: dashed) {
    .glossary-term {
        border-bottom: none;
        padding-bottom: 0;
    }
}

/* Mobile-specific styles */
.glossary-term {
    cursor: help;
    position: relative;
    text-decoration: none; 
    display: inline; 
    font-weight: 500;
}

.glossary-term::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 1px;
    border-bottom: 3.5px solid #3498db;
    border-radius: 2px;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.glossary-term:hover::after {
    opacity: 1;
    border-color: #1a73e8;
}

/* Ngăn chặn scroll khi modal mở */
body.glossary-modal-open {
    overflow: hidden;
    height: 100%;
}

/* Modal container */
.glossary-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 9999;
}

/* Modal content - cho phép scroll */
.modal-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

.glossary-modal li{
    font-family: 'Inter Display', Sans-Serif;
    line-height: 27.5px;
    color: #555;
    text-align: left;
    font-size: 1.6rem;
    font-weight: 400;
    text-transform: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.glossary-modal.active li {
    opacity: 1;
    transform: translateY(0);
}

.glossary-modal li + li {
    margin-top: 10px;
}

/* Animation delays for list items */
.glossary-modal.active li:nth-child(1) { transition-delay: 0.3s; }
.glossary-modal.active li:nth-child(2) { transition-delay: 0.35s; }
.glossary-modal.active li:nth-child(3) { transition-delay: 0.4s; }
.glossary-modal.active li:nth-child(4) { transition-delay: 0.45s; }
.glossary-modal.active li:nth-child(5) { transition-delay: 0.5s; }
.glossary-modal.active li:nth-child(6) { transition-delay: 0.55s; }
.glossary-modal.active li:nth-child(7) { transition-delay: 0.6s; }