/* ============================================
   HÙNG HERO - MAIN STYLESHEET (FIXED)
   ============================================ */

/* --- CSS VARIABLES --- */
:root { 
    --bg-body: #f8fafc; 
    --primary: #4f46e5; 
    --success: #10b981; 
    --danger: #ef4444; 
    --text-main: #1e293b; 
    --text-muted: #64748b; 
    --bg-btn-toggle: #f1f5f9;
    --bg-container: #ffffff; 
    --border: #f1f5f9;
}

.dark { 
    --bg-body: #0f172a; 
    --text-main: #f1f5f9; 
    --text-muted: #94a3b8; 
    --bg-container: #1e293b; 
    --bg-btn-toggle: #334155; 
    --border: #334155;
}

/* --- RESET & BASE --- */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-body); 
    color: var(--text-main); 
    padding: 15px; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

/* --- LAYOUT --- */
.container { 
    width: 100%; 
    max-width: 1100px; 
    background: var(--bg-container); 
    border-radius: 16px; 
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); 
    flex: 1; 
    overflow: hidden; 
}

.content-padding { 
    padding: 20px; 
}

/* --- HEADER --- */
header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding-bottom: 15px; 
    border-bottom: 1px solid var(--border); 
    margin-bottom: 20px; 
}

/* --- SIDEBAR --- */
.nav-sidebar { 
    position: fixed; 
    top: 0; 
    left: -280px; 
    width: 280px; 
    height: 100vh; 
    background: var(--bg-container); 
    z-index: 2100; 
    transition: 0.3s; 
    padding: 20px 15px; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav-sidebar.active { 
    left: 0; 
}

/* Sidebar Header */
.sidebar-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 5px; 
    margin-bottom: 20px;
}

.sidebar-brand {
    color: var(--primary); 
    font-size: 22px; 
    margin: 0; 
    font-weight: 800; 
    letter-spacing: -0.5px;
}

.sidebar-close {
    background: var(--bg-btn-toggle); 
    border: none; 
    width: 35px; 
    height: 35px; 
    border-radius: 10px; 
    font-size: 24px; 
    color: var(--text-main); 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    line-height: 1;
}

/* Navigation Links */
.nav-item-link {
    color: var(--text-main);
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 12px;
    transition: 0.2s;
    margin-bottom: 5px;
}

.nav-item-link:hover { 
    background: var(--bg-btn-toggle); 
    color: var(--primary); 
}

/* Dropdown Menu */
.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-top: 5px;
}

.dropdown-header:hover { 
    background: var(--bg-btn-toggle); 
    color: var(--primary); 
}

.dropdown-header.active { 
    color: var(--primary); 
    background: rgba(79, 70, 229, 0.05); 
}

.dropdown-header .arrow {
    font-size: 9px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
}

.dropdown-header.active .arrow { 
    transform: rotate(90deg); 
    opacity: 1; 
}

/* Submenu Animation */
.submenu-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease-out, opacity 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.submenu-content.show {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
}

.submenu-inner { 
    overflow: hidden; 
}

.sub-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    margin: 4px 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.sub-link:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateX(5px);
}

.game-icon {
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: 25px; 
    padding: 20px 10px; 
    border-top: 1px dashed var(--border);
}

.sidebar-footer a {
    display: block;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 12px;
}

.sidebar-footer .admin-link {
    color: var(--success);
    font-weight: 700;
}

.sidebar-footer .logout-link {
    color: var(--text-main);
    opacity: 0.7;
}

.sidebar-footer .login-link {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

/* --- SIDEBAR OVERLAY --- */
.sidebar-overlay { 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.5);
    z-index: 2050;
    display: none; 
    backdrop-filter: blur(2px);
    pointer-events: auto;
}

.sidebar-overlay.active { 
    display: block; 
}

body.menu-open {
    overflow: hidden;
}

/* --- MENU TOGGLE BUTTON --- */
.menu-toggle { 
    background: var(--bg-btn-toggle); 
    border: none; 
    padding: 10px; 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
}

.menu-toggle span { 
    width: 20px; 
    height: 2px; 
    background: var(--text-main); 
    display: block; 
}

/* --- ONLINE INDICATOR --- */
.dot-online { 
    width: 8px; 
    height: 8px; 
    background: #10b981; 
    border-radius: 50%; 
    display: inline-block; 
    animation: blink 2s infinite ease-in-out; 
}

@keyframes blink { 
    0% { opacity: 1; transform: scale(1); } 
    50% { opacity: 0.4; transform: scale(0.8); } 
    100% { opacity: 1; transform: scale(1); } 
}

/* --- SEARCH --- */
.search-container { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 20px; 
}

.search-wrapper { 
    position: relative; 
    flex: 1; 
    display: flex; 
    align-items: center; 
}

.search-input { 
    width: 100%; 
    padding: 12px 40px 12px 15px;
    border: 2px solid var(--border); 
    border-radius: 12px; 
    font-family: inherit; 
    background: var(--bg-body); 
    color: var(--text-main); 
    outline: none; 
    transition: 0.2s;
}

.clear-search {
    position: absolute;
    right: 12px;
    background: var(--bg-btn-toggle);
    color: var(--text-muted);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: 0.2s;
    z-index: 10;
}

/* QUAN TRỌNG: Hiển thị khi có class 'show' hoặc qua JS */
.clear-search.show {
    display: flex;
}

.clear-search:hover {
    background: var(--danger);
    color: white;
}

/* --- MOD GRID --- */
.mod-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 15px; 
}

.mod-card { 
    background: var(--bg-container); 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    padding: 15px; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    transition: 0.2s; 
}

.mod-card:hover { 
    border-color: var(--primary); 
    transform: translateY(-2px); 
}

.mod-title { 
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px; 
    font-weight: 700; 
    margin-bottom: 8px; 
    color: var(--text-main); 
}

.mod-title img {
    width: 24px; 
    height: 24px; 
    object-fit: contain;
}

.mod-desc { 
    font-size: 13px; 
    color: var(--text-muted); 
    line-height: 1.5; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.btn-more { 
    display: inline-block; 
    font-size: 12px; 
    color: var(--primary); 
    font-weight: 600; 
    cursor: pointer; 
    margin-bottom: 12px; 
    background: none; 
    border: none; 
    padding: 0; 
}

.mod-meta { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 12px; 
}

.mod-actions { 
    display: flex; 
    gap: 8px; 
    flex-wrap: wrap; 
}

/* --- BUTTONS --- */
.btn { 
    padding: 8px 12px; 
    border-radius: 8px; 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 12px; 
    cursor: pointer; 
    border: none; 
    display: inline-flex; 
    align-items: center; 
    gap: 5px; 
    transition: 0.2s; 
}

.btn-primary { 
    background: var(--primary); 
    color: white; 
}

.btn-download { 
    background: #eff6ff; 
    color: #2563eb; 
    flex: 1; 
    justify-content: center; 
}

.btn-chat { 
    background: #f0fdf4; 
    color: #16a34a; 
}

.btn-danger { 
    background: #fef2f2; 
    color: var(--danger); 
}

.btn-edit { 
    background: #fffbeb; 
    color: #d97706; 
}

.badge { 
    background: var(--bg-btn-toggle); 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 11px; 
}

/* --- PAGINATION --- */
.pagination { 
    display: flex; 
    justify-content: center; 
    gap: 8px; 
    margin: 30px 0; 
    flex-wrap: wrap;
}

.page-link { 
    padding: 8px 16px; 
    background: var(--bg-container); 
    border: 1px solid var(--border); 
    color: var(--text-main); 
    text-decoration: none; 
    border-radius: 8px; 
    font-weight: 600; 
    transition: 0.2s; 
}

.page-link:hover { 
    border-color: var(--primary); 
    color: var(--primary); 
}

.page-link.active { 
    background: var(--primary); 
    color: white; 
    border-color: var(--primary); 
}

/* --- NO RESULTS --- */
.not-found-container { 
    grid-column: 1 / -1; 
    text-align: center; 
    padding: 60px 20px; 
    background: var(--bg-body); 
    border: 2px dashed var(--border); 
    border-radius: 16px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

.not-found-icon {
    font-size: 50px; 
    margin-bottom: 15px; 
    opacity: 0.6;
}

.not-found-title {
    margin-bottom: 10px;
}

.not-found-text {
    color: var(--text-muted); 
    font-size: 14px; 
    margin-bottom: 20px;
}

/* --- TOP SLIDER --- */
.top-slider-section { 
    margin-top: 30px; 
    border-top: 1px solid var(--border); 
    padding-top: 20px; 
}

.slider-container { 
    display: flex; 
    gap: 12px; 
    overflow-x: auto; 
    padding-bottom: 10px; 
    scroll-snap-type: x mandatory; 
}

.slider-item { 
    min-width: 180px; 
    background: var(--bg-body); 
    border: 1px solid var(--border); 
    padding: 12px; 
    border-radius: 10px; 
    scroll-snap-align: start; 
}

.slider-title {
    font-weight: 700; 
    font-size: 14px; 
    margin-bottom: 5px; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap;
}

.slider-downloads {
    font-size: 11px; 
    color: var(--text-muted); 
    margin-bottom: 10px;
}

/* --- MODAL --- */
.modal { 
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(4px); 
    z-index: 3000; 
    align-items: center; 
    justify-content: center; 
    padding: 20px; 
}

/* QUAN TRỌNG: Modal active phải có display: flex */
.modal.active {
    display: flex;
}

.modal-content { 
    background: var(--bg-container); 
    padding: 20px; 
    border-radius: 16px; 
    width: 100%; 
    max-width: 450px; 
}

.modal-content.confirm {
    max-width: 350px; 
    text-align: center;
}

.modal-title {
    font-size: 16px; 
    border-bottom: 1px solid var(--border); 
    padding-bottom: 10px; 
    margin-bottom: 10px;
}

.scroll-box { 
    background: #1e293b; 
    color: #38bdf8; 
    padding: 15px; 
    border-radius: 10px; 
    font-family: monospace; 
    font-size: 13px; 
    margin: 15px 0; 
    max-height: 350px; 
    overflow-y: auto; 
    white-space: pre-wrap; 
    word-break: break-word; 
}

.modal-warning-icon {
    font-size: 50px; 
    color: var(--danger); 
    margin-bottom: 10px;
}

.modal-text {
    color: var(--text-muted); 
    font-size: 14px; 
    margin-bottom: 20px;
}

.modal-actions {
    display: flex; 
    gap: 10px;
}

.modal-btn-cancel {
    flex: 1; 
    justify-content: center; 
    background: var(--bg-btn-toggle); 
    color: var(--text-main);
}

.modal-btn-confirm {
    flex: 1; 
    justify-content: center; 
    background: var(--danger); 
    border: none;
    color: white;
}

/* --- TOAST --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--bg-container);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    animation: slideIn 0.3s ease-out, fadeOut 0.5s ease-out 2.5s forwards;
    min-width: 250px;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-20px); }
}

/* --- FOOTER --- */
footer {
    margin-top: 30px; 
    border-bottom: 20px solid transparent; 
    width: 100%;
}

.footer-content {
    text-align: center; 
    padding: 30px 15px; 
    color: var(--text-muted);
}

.footer-visit-count {
    display: flex; 
    justify-content: center; 
    margin-bottom: 20px;
}

.visit-badge {
    background: var(--bg-container); 
    padding: 12px 25px; 
    border-radius: 50px; 
    border: 1px solid var(--border); 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); 
    display: inline-flex; 
    align-items: center; 
    gap: 10px;
}

.visit-dot {
    width: 8px; 
    height: 8px; 
    background: var(--primary); 
    border-radius: 50%;
}

.visit-label {
    font-size: 11px; 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    font-weight: 600;
}

.visit-number {
    font-size: 16px; 
    font-weight: 800; 
    color: var(--text-main);
}

.footer-copyright {
    font-size: 14px; 
    letter-spacing: 0.3px;
}

.footer-copyright a {
    color: var(--primary); 
    text-decoration: none; 
    font-weight: 700;
}

.footer-note {
    font-size: 11px; 
    margin-top: 8px; 
    opacity: 0.6;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) { 
    .mod-grid { 
        grid-template-columns: 1fr; 
    } 
}

/* --- THEME TOGGLE --- */
#theme-toggle {
    background: var(--bg-btn-toggle); 
    font-size: 16px;
}

/* --- GREETING --- */
.greeting-container {
    display: flex; 
    align-items: center; 
    gap: 8px;
}

.greeting-text {
    font-size: 13px; 
    font-weight: 600; 
    color: var(--text-muted);
}

/* --- HEADER ACTIONS --- */
.header-actions {
    display: flex; 
    align-items: center; 
    gap: 10px;
}

/* --- UTILITY --- */
.text-center { text-align: center; }
.w-full { width: 100%; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }

/* ============================================
   COPY LINK NOTIFICATION - MODERN DESIGN
   ============================================ */

.copy-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.copy-toast {
    background: linear-gradient(135deg, var(--bg-container) 0%, var(--bg-btn-toggle) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04),
                0 0 0 1px rgba(79, 70, 229, 0.1);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: copySlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards,
               copyFadeOut 0.5s ease-out 2.5s forwards;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.copy-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary), #8b5cf6);
    border-radius: 16px 0 0 16px;
}

.copy-toast.success::before {
    background: linear-gradient(to bottom, #10b981, #34d399);
}

.copy-toast.error::before {
    background: linear-gradient(to bottom, #ef4444, #f87171);
}

.copy-toast-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    animation: iconPop 0.5s ease-out;
}

.copy-toast.success .copy-toast-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.copy-toast.error .copy-toast-icon {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.copy-toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.copy-toast-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.copy-toast-message {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.copy-toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copy-toast-close:hover {
    background: var(--bg-btn-toggle);
    color: var(--text-main);
}

.copy-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
    border-radius: 0 0 16px 16px;
    overflow: hidden;
}

.copy-toast-progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--primary), #8b5cf6);
    border-radius: 0 0 16px 16px;
    animation: progressShrink 3s linear forwards;
    transform-origin: left;
}

.copy-toast.success .copy-toast-progress-bar {
    background: linear-gradient(to right, #10b981, #34d399);
}

.copy-toast.error .copy-toast-progress-bar {
    background: linear-gradient(to right, #ef4444, #f87171);
}

/* Animations */
@keyframes copySlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes copyFadeOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
}

@keyframes iconPop {
    0% {
        transform: scale(0) rotate(-180deg);
    }
    70% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes progressShrink {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Dark mode adjustments */
.dark .copy-toast {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 
                0 10px 10px -5px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Responsive */
@media (max-width: 480px) {
    .copy-toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .copy-toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}
/* Đảm bảo modal đè lên mọi thứ */
.modal {
    z-index: 9999 !important;
    background: rgba(0, 0, 0, 0.7) !important; /* Làm tối nền hơn */
    backdrop-filter: blur(4px); /* Làm mờ nội dung phía sau */
    pointer-events: auto; /* Chặn click xuyên qua */
}

/* Khi modal mở, chặn mọi tương tác với phần tử bên dưới */
body[style*="overflow: hidden"] .container {
    pointer-events: none;
    user-select: none;
}

/* Nhưng vẫn cho phép tương tác bên trong Modal */
.modal-content {
    pointer-events: auto !important;
}