:root {
    --bg-global: #0a0a0a;      /* Nền chính tối hơn, gần như đen */
    --bg-card: #FFFFFF;        /* Nền thẻ giữ nguyên màu trắng để có độ tương phản cao */
    --text-main: #E5E7EB;      /* Màu chữ chính sáng hơn một chút, dễ đọc hơn */
    --text-muted: #9CA3AF;     /* Màu chữ phụ, xám dịu mắt */
    --accent-cool: #10B981;    /* Màu nhấn xanh lá cây hiện đại, nổi bật */
    --accent-hover: #059669;   /* Màu nhấn khi hover, tối hơn một chút */
    --header-bg: rgba(10, 10, 10, 0.8); /* Nền header bán trong suốt */
    --accent-light: #1F2937;   /* Nền hover/khung chứa trên giao diện tối (xám đậm) */
    --border-color: #374151;   /* Viền tối màu, rõ ràng hơn trên nền mới */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-heading: "Poppins", var(--font-sans);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-global);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-main);
}

/* Header & Search */
.app-header {
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 102;
    padding: 0 2rem;
    transition: transform 0.3s ease-in-out;
}
.app-header.header-hidden { transform: translateY(-100%); }

.header-container { 
    max-width: 1180px; 
    height: 70px; 
    margin: 0 auto; 
    display: flex; 
    align-items: center; /* Căn giữa tất cả khối theo chiều dọc */
    justify-content: space-between; 
    gap: 1.5rem; 
}

.brand {
    display: flex;
    align-items: center;
}

.logo { 
    font-size: 1.4rem; 
    font-weight: 700; 
    letter-spacing: -0.03em; 
    color: #ffffff; 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
}
.logo span { color: #94A3B8; }

.search-box { 
    position: relative; 
    width: 360px; 
    display: flex;
    align-items: center; /* Căn giữa ô input và icon search theo chiều dọc */
}


.search-icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: #94A3B8; }
#searchInput {
    width: 100%;
    height: 38px;
    background-color: #021121;
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Giữ nguyên bo góc */
    padding: 0 2.5rem 0 2.2rem; /* Tăng padding phải để có chỗ cho nút xóa */
    color: #f8f9fa;
    font-size: 0.9rem;
    transition: border-color 0.2s, background-color 0.2s;
}
#searchInput::placeholder { color: #64748B; }
#searchInput:focus { outline: none; border-color: var(--accent-cool); background-color: #061a2e; }

/* Nút xóa nội dung trong ô tìm kiếm */
.clear-search-btn {
    position: absolute;
    right: 0.5rem; /* Căn phải */
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 4px;
    display: none; /* Mặc định ẩn đi */
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
}
.clear-search-btn:hover { color: #FFFFFF; transform: translateY(-50%) scale(1.1); }
.clear-search-btn svg { width: 16px; height: 16px; }

.search-box:focus-within .search-icon { color: var(--accent-cool); }
.nav-right-side { display: flex; align-items: center; gap: 1.5rem; }

.view-toggle { 
    display: flex; 
    align-items: center; /* Căn giữa các nút icon toggle */
    background-color: #0d233a; 
    padding: 4px; 
    border-radius: 6px; 
    border: 1px solid var(--border-color); 
    margin-left: auto; /* Đẩy khối toggle về sát bên phải nếu div nav-right-side rỗng */
}
.toggle-btn { 
    background: transparent; 
    border: none; 
    color: #94A3B8; 
    padding: 6px; 
    border-radius: 4px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.toggle-btn.active { background-color: var(--accent-cool); color: #ffffff; }
.toggle-btn svg { width: 18px; height: 18px; }

.nav-utility-link { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    color: #94A3B8; 
    text-decoration: none; 
    font-weight: 500; 
    transition: color 0.2s ease; 
    font-size: 0.95rem; 
}
.nav-utility-link:hover { color: #ffffff; }
.nav-utility-link > svg { width: 18px; height: 18px; }

/* Hero Section */
.hero { 
    max-width: 1280px; 
    margin: 2.5rem auto 2rem auto; 
    padding: 0 2rem; 
    text-align: center; 
}

.list-mode .hero { display: none; } /* Ẩn hero trong list mode */

.hero h1 { 
    font-size: clamp(2rem, 4vw, 3.2rem); 
    font-weight: 800; 
    letter-spacing: -0.04em; 
    line-height: 1.15; 
    margin-bottom: 1rem; 
    color: #FFFFFF; /* Màu chữ tiêu đề trắng sáng nổi bật */
}

.hero p {
    color: var(--text-muted); /* Màu xám nhạt (#94A3B8) đã định nghĩa ở phần 1 */
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    max-width: 600px;
    margin: 0 auto 1rem auto;
}

/* Filter Tags Section */
.tags-container { 
    max-width: 1280px; 
    margin: 0 auto 3rem auto; 
    padding: 0 2rem; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.6rem; 
    justify-content: center; 
}

.tag { 
    background-color: var(--accent-light); 
    border: 1px solid var(--border-color); 
    color: var(--text-muted); 
    padding: 0.4rem 1.1rem; 
    border-radius: 20px; 
    font-size: 0.88rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); 
    user-select: none; 
}

.tag:hover { 
    color: #FFFFFF; 
    background-color: #374151; 
    border-color: #031835; 
}

.tag.active { 
    background-color: var(--accent-cool); 
    border-color: var(--accent-cool); 
    color: #ffffff; 
}

.tag .tag-count { 
    color: var(--text-muted); 
    font-weight: 500; 
    transition: color 0.2s ease; 
}

.tag.active .tag-count, 
.tag:hover .tag-count { 
    color: inherit; 
}

.tag[data-filter="new"].active,
.tag[data-filter="new"]:hover { 
    background-color: #EF4444; 
    border-color: #EF4444; 
    color: #ffffff; 
}

/* Main Content & Layout Modes */
/* Main Content & Layout Modes */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem 3rem 2rem;
    flex-grow: 1;
    width: 100%;
}
.main-content.grid-mode .list-view-container { display: none; }
.main-content.list-mode .grid-view-container { display: none; }

/* Masonry layout for Grid mode */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 10px;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .header-container { gap: 1rem; }
    .grid-container { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@keyframes card-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Font Card (Giữ nền trắng) */
.font-card {
    background-color: var(--bg-card);
    /* Nền trắng như yêu cầu */
    border-radius: 12px;
    padding: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    opacity: 0;
    animation: card-enter 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    position: relative;
    overflow: hidden;
}
.list-mode .font-card { display: none; }

.font-card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); 
}

/* Font Graphic Preview Area */
.card-image-placeholder {
    width: 100%;
    background-color: #e2e8f0;
    border-radius: 12px 12px 0 0;
    display: block;
    cursor: pointer;
    transition: opacity 0.3s ease;
    object-fit: cover;
}

.card-footer { padding: 1rem 1.25rem 1.25rem; }
.card-title-line { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.85rem; }
/* CSS cho bộ đếm lượt tải và lượt thích */
.card-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569; /* Màu chữ tối hơn trên nền trắng */
    background-color: #F1F5F9;
    padding: 3px 8px;
    border-radius: 12px;
}
.stat-item svg {
    width: 14px; height: 14px;
}
/* Thêm style cho nút Like */
.like-button {
    cursor: pointer;
    border: none;
    transition: background-color 0.2s, color 0.2s;
}
.like-button:hover {
    background-color: #E0E7FF; /* Màu nền khi hover */
    color: #3730A3;
}
.like-button.liked, .like-button:disabled {
    background-color: #C7D2FE;
    color: #4338CA;
    cursor: default;
}
/* Tên font tối màu trên nền card trắng */
.card-title-line {
    align-items: flex-start; /* Căn các item từ trên xuống */
}

.card-font-details { flex-grow: 1; }

.card-font-name {
    font-size: 1.1rem; 
    font-weight: 600; 
    margin-bottom: 0; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    color: #1E293B; 
    font-family: var(--font-heading); 
    letter-spacing: -0.01em; 
}

.card-font-meta {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748B;
    margin-top: 2px;
}

.card-font-meta .font-glyphs-count { color: #64748B; }

.badge-container { display: flex; gap: 0.4rem; flex-shrink: 0; }

.new-ribbon { position: absolute; top: 10px; right: -25px; transform: rotate(45deg); background-color: #DC2626; color: white; padding: 4px 30px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 5; letter-spacing: 0.5px; }
.new-badge, .update-badge { padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; line-height: 1.4; }
.new-badge { background-color: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.update-badge { background-color: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* Card Action Buttons */
.card-actions { display: flex; gap: 0.75rem; margin-top: auto; }
.btn { flex: 1; padding: 0.65rem 1rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; transition: all 0.2s ease; text-decoration: none; }
.btn > svg { width: 16px; height: 16px; }

/* Nút phụ trong card trắng */
.btn-secondary { background-color: #F1F5F9; border: 1px solid #CBD5E1; color: #1E293B; }
.btn-secondary:hover { background-color: #E2E8F0; border-color: #94A3B8; color: #0F172A; }

/* Nút chính */
.btn-primary { background-color: var(--accent-cool); border: 1px solid var(--accent-cool); color: #ffffff; }
.btn-primary:hover { background-color: var(--accent-hover); border-color: var(--accent-hover); }

/* Load More Button Styles */
.load-more-container {
    grid-column: 1 / -1; /* Span full width of the grid */
    text-align: center;
    padding: 2rem 0;
}

.load-more-container #loadMoreBtn {
    padding: 0.8rem 2.5rem;
    font-size: 1rem;
    min-width: 200px;
    flex: none; /* Override flex: 1 from .btn */
}

.load-more-container #endOfResultsMessage {
    color: var(--text-muted);
    margin-top: 1rem;
    font-weight: 500;
}




/* List View Specific Styles */
.list-view-container {
    display: flex;
    gap: 2rem;
    margin-top: 0;
}

.font-menu-list { 
    list-style: none; 
    flex: 0 0 300px; 
    max-height: calc(100vh - 200px); 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    border-right: 1px solid var(--border-color); 
    padding-right: 2rem; 
}

.font-menu-item { 
    padding: 10px 16px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-family: var(--font-heading); 
    font-weight: 500; 
    font-size: 0.95rem; 
    color: var(--text-main);
    transition: background-color 0.2s, color 0.2s; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.font-menu-item:hover { 
    background-color: var(--accent-light); 
    color: #FFFFFF;
}

.font-menu-item.active { 
    background-color: var(--accent-hover); 
    color: #ffffff; 
}

.menu-style-count { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
    font-weight: 400; 
    background-color: var(--accent-light); 
    padding: 2px 6px; 
    border-radius: 4px; 
}

.font-menu-item.active .menu-style-count { 
    background-color: var(--accent-cool); 
    color: #ffffff; 
}

.font-detail-pane { flex-grow: 1; }
.list-mode .tags-container { display: none; }

@media (max-width: 992px) {
    .list-view-container { flex-direction: column; }
    .font-menu-list { 
        flex: 1 1 auto; 
        max-height: 300px; 
        border-right: none; 
        border-bottom: 1px solid var(--border-color); 
        padding-right: 0; 
        margin-bottom: 2rem; 
    }
}

.empty-detail-state { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 300px; 
    color: var(--text-muted); 
    background-color: transparent; 
    border: 2px dashed var(--border-color); 
    border-radius: 12px; 
}

/* Khung chi tiết Font (Nền trắng) */
.font-detail-card { 
    background-color: var(--bg-card); 
    border-radius: 12px; 
    padding: 2rem; 
    border: 1px solid var(--border-color); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #1E293B; /* Default text color for elements inside the white card */
}

.font-detail-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.font-detail-header h3 { 
    font-size: 2rem; 
    font-weight: 700; 
    color: #1E293B; /* Chữ tối trên nền card trắng */
}

.font-detail-header p { color: #64748B; }



/* Input cho văn bản tùy chỉnh trong List View (Nằm trong card trắng) */
#listCustomTextInput {
    width: 100%;
    padding: 10px 16px;
    font-size: 1rem;
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    color: #1E293B; /* Chữ tối trên nền trắng */
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-sans);
}

#listCustomTextInput::placeholder {
    color: #94A3B8;
}

#listCustomTextInput:focus {
    outline: none;
    border-color: var(--accent-cool);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Detail Controls (Size Slider & Text Format) */
.detail-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    border-radius: 8px;
}

.detail-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.detail-controls .text-input-group { color: #1E293B; width: 100%; text-align: center; }

.text-format-controls {
    display: flex;
    background-color: #F1F5F9;
    padding: 4px;
    border-radius: 6px;
}

.format-btn {
    background: transparent;
    border: none;
    color: #64748B;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.format-btn.active {
    background-color: #FFFFFF;
    color: #059669;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}



/* Toggle Switch for Vietnamese Support *//* Toggle Switch for Vietnamese Support */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 100px;
    height: 34px;
    margin-left: 10px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E2E8F0; /* Màu nền khi tắt nút */
    border-radius: 34px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748B;
}

.toggle-switch-label::before {
    content: "EN";
    display: block;
    position: absolute;
    left: 10px;
    color: #64748B;
}

.toggle-switch-label::after {
    content: "VN";
    display: block;
    position: absolute;
    right: 10px;
    color: #64748B;
}

.toggle-switch-switch {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: #FFFFFF;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-switch-label {
    background-color: var(--accent-hover); /* Màu khi bật (On) */
}

.toggle-switch input:checked + .toggle-switch-label::before {
    color: #94A3B8;
}

.toggle-switch input:checked + .toggle-switch-label::after {
    color: var(--accent-cool);
}

.toggle-switch input:checked + .toggle-switch-label .toggle-switch-switch {
    transform: translateX(66px);
}

/* Remove previous specific style for vietnamese button */
.format-btn[data-format="vietnamese"] {
    display: none;
}

/* Adjust media query for smaller screens */
@media (max-width: 600px) {
    .detail-controls-row.slider-and-format-row {
        flex-direction: column;
        align-items: stretch;
    }
    .detail-controls .input-group.size-slider-group {
        max-width: 100%;
    }
    .text-format-controls {
        width: 100%;
        justify-content: space-around;
    }
    .toggle-switch {
        margin-left: 0;
    }
}


/* Custom Multi-column Dropdown */
.custom-select-container {
    position: relative;
    flex-shrink: 0;
    min-width: 450px;
}
.custom-select-container label { display: none; }

.custom-select-trigger {
    width: 100%;
    padding: 10px 12px;
    background-color: #F1F5F9;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    font-size: 1rem;
    color: #1E293B;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.custom-select-trigger:focus { outline: none; border-color: var(--accent-cool); }
.custom-select-trigger svg { transition: transform 0.2s ease; }
.custom-select-container.open .custom-select-trigger svg { transform: rotate(180deg); }

.custom-select-options {
    display: none;
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: #FFFFFF; 
    border: 1px solid #CBD5E1; 
    border-radius: 8px; 
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    padding: 0.5rem; 
    z-index: 10; 
    max-height: 400px; 
    overflow-y: auto;
    column-count: 3; 
    column-gap: 0.5rem;
}
.custom-select-container.open .custom-select-options { display: block; }

.custom-select-option {
    font-size: 0.85rem;
    color: #1E293B;
    padding: 8px 12px; 
    border-radius: 6px; 
    cursor: pointer;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    break-inside: avoid-column;
}
.custom-select-option:hover { background-color: #F1F5F9; }
.custom-select-option.selected { background-color: var(--accent-hover); color: #ffffff; }

/* Font Style List */
.style-list-container { display: flex; flex-direction: column; gap: 1rem; }
.style-row { background-color: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px; padding: 1rem 1.25rem; }
.style-meta { font-size: 0.75rem; color: #64748B; font-family: var(--font-heading); font-weight: 600; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.5px; }
.style-preview-text { color: #0F172A; word-break: break-word; line-height: 1.4; transition: font-size 0.2s; }

.detail-actions { margin-top: 2rem; }
.detail-actions .btn { flex: none; }

/* Glyph Preview for List View */
.glyph-preview-container { margin-top: 2.5rem; }
.glyph-preview-header { font-family: var(--font-heading); font-weight: 600; font-size: 1rem; color: #1E293B; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid #E2E8F0; }
.glyph-preview-grid { display: flex; flex-wrap: wrap; gap: 4px; background-color: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px; padding: 1rem; }
.glyph-char { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; background-color: #FFFFFF; border: 1px solid #CBD5E1; border-radius: 4px; font-size: 24px; color: #0F172A; }


/* Nút Back to Top */
#backToTopBtn { 
    display: none; 
    position: fixed; 
    bottom: 25px; 
    right: 25px; 
    z-index: 99; 
    border: none; 
    outline: none; 
    background-color: var(--accent-cool); 
    color: white; 
    cursor: pointer; 
    padding: 0; 
    border-radius: 50%; 
    width: 48px; 
    height: 50px; 
    font-size: 24px; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); 
    transition: opacity 0.3s, transform 0.3s; 
}
#backToTopBtn:hover { 
    background-color: var(--accent-hover); 
    transform: translateY(-2px); 
}

/* Detail Modal Styles (Nền trắng) */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.75); 
    backdrop-filter: blur(6px); 
    -webkit-backdrop-filter: blur(6px); 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.3s ease; 
    z-index: 1000; 
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.detail-modal { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    background-color: var(--bg-card); /* Giữ nền trắng */
    border-top: 1px solid #E2E8F0; 
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); 
    z-index: 1001; 
    transform: translateY(100%); 
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); 
    max-height: 90vh; 
    overflow-y: auto; 
}
.detail-modal.active { transform: translateY(0); }

.modal-content-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    grid-template-areas: "info image";
    gap: 3rem;
    align-items: flex-start;
}

.modal-header { margin-bottom: 1.5rem; }
.modal-header h2 { 
    font-size: 2.5rem; 
    font-weight: 800; 
    letter-spacing: -0.04em; 
    margin-bottom: 0.5rem; 
    line-height: 1.2; 
    color: #1E293B; /* Chữ màu tối trên nền modal trắng */
}
.modal-header p { font-size: 1.1rem; color: #64748B; }

.modal-meta { margin-bottom: 2.5rem; }
.modal-font-info .tag { display: inline-block; pointer-events: none; }
.modal-font-info { grid-area: info; }

.modal-description { 
    font-size: 0.95rem; 
    color: #475569; 
    line-height: 1.7; 
    padding-left: 1.5rem; 
    border-left: 3px solid #CBD5E1; 
}
.modal-description p { margin-bottom: 0.75rem; }

.modal-download-actions { margin-top: 2.5rem; max-width: 300px; }
.modal-download-actions .btn { padding-top: 0.8rem; padding-bottom: 0.8rem; font-size: 1rem; }

.modal-image-container { 
    position: relative; 
    background-color: #F1F5F9; 
    border-radius: 8px; 
    overflow: hidden; 
    grid-area: image; 
}
.modal-image-container.loading::before { 
    content: ''; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    width: 40px; 
    height: 40px; 
    margin-top: -20px; 
    margin-left: -20px; 
    border: 4px solid rgba(0, 0, 0, 0.1); 
    border-top-color: var(--accent-cool); 
    border-radius: 50%;
    animation: spin 0.8s linear infinite; 
    z-index: 2; 
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-image-container img { 
    width: 100%; 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 
    border: 1px solid #E2E8F0; 
    opacity: 1; 
    transition: opacity 0.3s ease-in-out; 
}
.modal-image-container.loading img { opacity: 0; }

.btn-close-modal { 
    position: absolute; 
    top: 1.5rem; 
    right: 2rem; 
    background-color: #F1F5F9; 
    border: none; 
    border-radius: 50%; 
    width: 40px; 
    height: 40px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.75rem; 
    font-weight: 300; 
    color: #64748B; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    line-height: 1; 
}
.btn-close-modal:hover { 
    background-color: #E2E8F0; 
    color: #0F172A; 
}

@media (max-width: 768px) {
    .app-header { padding: 0 1rem; }
    .search-box, .view-toggle { display: none; }
    .main-content { padding: 0 1rem 3rem 1rem; }
    .hero { margin-top: 2rem; margin-bottom: 2rem; padding: 0 1rem; }
    .tags-container { padding: 0 1rem; margin-bottom: 2rem; }

    .modal-content-inner {
        padding: 4rem 1.5rem 2rem 1.5rem;
        grid-template-columns: 1fr;
        grid-template-areas: 
            "image"
            "info";
        gap: 2rem;
    }
    .modal-header h2 { font-size: 2rem; }
    .btn-close-modal { top: 1rem; right: 1rem; }
}

@media (max-width: 480px) {
    .brand { flex-grow: 1; }
    .search-box { display: none; }
}

@media (max-width: 820px) {
    .privacy-content {
        flex-direction: column;
    }
}

/* --- PRIVACY POLICY SLIDE-UP MODAL --- */

/* --- PRIVACY MODAL (Lá trượt từ dưới lên - Bottom Sheet full chiều ngang) --- */
.privacy-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    background-color: var(--bg-card, #1e1e24);
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
    
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    
    /* Mặc định giấu xuống dưới đáy màn hình */
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
    display: none; /* Khống chế hiển thị bởi JS */
}

/* Trạng thái kích hoạt: Trượt lên từ đáy */
.privacy-modal.open {
    display: block;
    visibility: visible;
    transform: translateY(0);
}

/* Khối nội dung bên trong - Rộng tối đa 1400px và căn giữa */
.privacy-modal-content {
    max-width: 1200px; /* Độ rộng ngang tối đa cho văn bản 2 cột */
    margin: 0 auto;
    padding: 40px 36px 32px 36px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-sizing: border-box;
}

/* Tùy chỉnh thanh cuộn đẹp mắt */
.privacy-modal-content::-webkit-scrollbar {
    width: 6px;
}
.privacy-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Định dạng 2 cột Tiếng Việt & Tiếng Anh rộng rãi */
.privacy-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 40px;
    margin-top: 24px;
}

/* Nút đóng góc trên bên phải */
.privacy-close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    background: transparent;
    border: none;
    color: var(--text-muted, #aaa);
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    z-index: 10;
}

.privacy-close-btn:hover {
    color: var(--text-main, #fff);
}
.privacy-header { text-align: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid #E5E7EB; }
.privacy-header h3 { font-size: 1.6rem; color: #111; font-family: var(--font-heading); margin-bottom: 5px; }
.privacy-header p { color: #6B7280; font-size: 0.95rem; }
.privacy-columns { display: flex; gap: 25px; }
.privacy-column { flex: 1; background: #f8f9fa; padding: 20px 22px; border-radius: 12px; border: 1px solid #e9ecef; }
.privacy-column h4 { font-size: 1rem; color: var(--accent-cool); margin-bottom: 12px; border-bottom: 2px solid var(--accent-cool); padding-bottom: 6px; text-transform: uppercase; }
.privacy-column h5 { font-size: 0.92rem; color: #2c3e50; margin-top: 12px; margin-bottom: 4px; font-weight: 600; }
.privacy-column p { font-size: 0.85rem; color: #4a5568; line-height: 1.5; margin-bottom: 8px; }
@media (max-width: 768px) { .privacy-columns { flex-direction: column; gap: 20px; } }














/* Footer */
.app-footer { 
    background-color: #061a2e; /* Tone màu xanh đen đồng bộ với Header */
    border-top: 1px solid var(--border-color);
    color: var(--text-muted); 
    padding: 4rem 2rem 2rem; 
    margin-top: 5rem; 
}

.footer-container { 
    max-width: 1280px; 
    margin: 0 auto; 
    display: grid; 
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); 
    gap: 3rem; 
    margin-bottom: 3rem; 
}

.footer-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 0.5rem;
}

.footer-brand .accent-dot {
    color: var(--accent-cool);
}

.footer-info p { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    margin-top: 6px; 
}

.footer-info .copyright {
    color: #64748B;
    margin-top: 12px;
}

.footer-links h4 { 
    font-family: var(--font-heading); 
    color: #F1F5F9; 
    font-size: 1rem; 
    font-weight: 600; 
    margin-bottom: 1rem; 
}

.footer-links ul { 
    list-style: none; 
    display: flex; 
    flex-direction: column; 
    gap: 0.75rem; 
}

.footer-links a { 
    color: var(--text-muted); 
    text-decoration: none; 
    transition: color 0.2s ease; 
    font-size: 0.9rem;
}

.footer-links a:hover { 
    color: #FFFFFF; 
}

.footer-bottom { 
    max-width: 1280px; 
    margin: 0 auto; 
    padding-top: 2rem; 
    border-top: 1px solid var(--border-color); 
    text-align: center; 
    font-size: 0.88rem; 
    color: #64748B; 
}

@media (max-width: 768px) {
    .footer-container { grid-template-columns: 1fr; gap: 2.5rem; }
    .app-footer { padding: 3rem 1.5rem; }
}