/* 1. VARIABLES & RESET */
:root {
    --primary-dark: #06276F;
    --primary-medium: #0D47A1;
    --primary: #1565C0;
    --primary-light: #1E88E5;
    --bg-color: #f0f4f7;
    --text-color: #333;
    --text-muted: #888;
    --white: #ffffff;
    --danger: #d32f2f;
    --danger-dark: #b71c1c;
    --warning: #fbc02d;
    --teal-dark: #004d40;
    --teal-light: #00796b;
    --border-color: #eee;
    --border-dashed: #ccc;
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --font-stack: 'Segoe UI', Arial, sans-serif;
}

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

body, input, select, textarea, button {
    font-family: var(--font-stack);
}

body {
    background-color: var(--bg-color);    
    background-image: 
        radial-gradient(#d5dce6 1.5px, transparent 1.5px), 
        radial-gradient(#d5dce6 1.5px, transparent 1.5px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; }
.hidden { display: none !important; }
.desktop-only { display: block; }
.txt-mb { display: none; }
.txt-pc { display: inline; }

/* UTILITY CLASSES */
.w-100 { width: 100%; }
.mt-10 { margin-top: 10px; }
.text-center { text-align: center; }
hr.dashed { margin: 15px 0; border: 0; border-top: 1px dashed var(--border-dashed); }

/* 2. LAYOUT & HEADER */
.site-wrapper {
    max-width: 1200px;
    width: 95%;
    margin: 30px auto;
    background-color: var(--white);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 95vh;
}
.container {
    width: 100%;
    margin: 0 auto; 
    padding: 0 20px;
}

.brand-header { margin-top: 0; }

.header-layout {
    display: flex;
    width: 100%; height: 130px;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative; overflow: hidden;
}

.header-right {
    width: 100%; flex-grow: 1; position: relative;
    background: radial-gradient(circle at 30% 50%, var(--primary), var(--primary-dark));
    overflow: hidden;
}

.header-right::before {
    content: ""; position: absolute; right: 5%; top: 50%;
    transform: translateY(-50%) rotate(15deg);
    width: 250px; height: 250px;
    background: linear-gradient(to right, transparent 40%, rgba(255,255,255,0.07) 40%, rgba(255,255,255,0.07) 60%, transparent 60%),
                linear-gradient(to bottom, transparent 40%, rgba(255,255,255,0.07) 40%, rgba(255,255,255,0.07) 60%, transparent 60%);
    pointer-events: none; z-index: 0; border-radius: 20px;
}

.header-right::after {
    content: ""; position: absolute; right: 22%; bottom: 10%;
    width: 100px; height: 100px;
    background: linear-gradient(to right, transparent 42%, rgba(255,255,255,0.05) 42%, rgba(255,255,255,0.05) 58%, transparent 58%),
                linear-gradient(to bottom, transparent 42%, rgba(255,255,255,0.05) 42%, rgba(255,255,255,0.05) 58%, transparent 58%);
    transform: rotate(-10deg); pointer-events: none; z-index: 0; border-radius: 10px;
}

#site-cover { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    position: absolute; 
    top: 0; 
    left: 0; 
    z-index: 0; 
    display: none;
}

.header-overlay {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
    display: flex; flex-direction: column; justify-content: center;
    padding-left: 40px; color: var(--white); z-index: 1;
}

.site-title h1 {
    font-size: 2.2rem; font-weight: 800;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7); line-height: 1.2;
}
.site-title p { font-size: 1.1rem; font-weight: 600; margin-bottom: 5px; }

/* 3. NAVIGATION */
.main-menu {
    background: linear-gradient(90deg, var(--primary-light), var(--primary-medium));
    position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%; margin: 0;
}
.main-menu .container { display: flex; align-items: center; padding: 0 10px; width: 100%; }

#nav-list {
    display: flex; flex-wrap: wrap; list-style: none; padding: 0;
    flex-grow: 1; width: auto; order: 1;
}
#nav-list a {
    display: block; padding: 10px 20px; color: var(--white);
    font-weight: 600; text-decoration: none; transition: 0.3s;
}
#nav-list a:hover, #nav-list a.active { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }

.mobile-menu-btn {
    display: none; background: var(--primary-medium); color: var(--white);
    border: none; padding: 8px 15px; border-radius: 4px; font-size: 1.2rem; cursor: pointer;
}

#auth-action-area { order: 2; margin-left: auto; white-space: nowrap; }
.btn-auth-mobile {
    text-decoration: none; padding: 10px 20px; border-radius: 4px;
    font-size: 1rem; font-weight: 600; display: inline-block; transition: 0.3s;
}
.btn-auth-mobile.login { color: var(--white); border: none; }
.btn-auth-mobile.login:hover { background: var(--primary-medium); }
.btn-auth-mobile.logout { background: var(--danger-dark); color: var(--white); }

/* 4. CONTENT & COMPONENTS */
.main-content { 
    padding: 30px 20px; 
    flex: 1; 
    min-height: 70vh;
}

.content-box {
    background: var(--white); padding: 25px; border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05); margin-bottom: 25px;
    border: 1px solid var(--border-color); 
}

.section-header-flex {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; border-bottom: 3px solid var(--primary); padding-bottom: 10px;
}
.section-heading {
    color: var(--primary-medium); font-size: 1.5rem;
    font-weight: 700; text-transform: uppercase;
}

.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 30px; align-content: start; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.staff-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.staff-row-break { flex-basis: 100%; height: 0; }

.post-card {
    background: var(--white); border-radius: var(--border-radius);
    overflow: hidden; box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color); cursor: pointer; transition: 0.3s;
}
.post-card:hover { transform: translateY(-5px); }
.post-card img { 
    width: 100%; 
    height: 200px; 
    object-fit: cover; 
    background-color: #e0e0e0;
    display: block;
}
.post-content { padding: 15px; }

/* Custom elements from inline to classes */
#detail-title.no-border { border: none; padding: 0; }
.detail-date { color: var(--text-muted); margin-bottom: 20px; }

.contact-box h3 {
    color: var(--primary-medium);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px; margin-bottom: 10px;
}
.contact-box h3.mt-25 { margin-top: 25px; }
.contact-box i { color: var(--primary); }

#detail-img, #intro-img {
    width: 100%; height: auto; max-height: none;
    object-fit: contain; border-radius: 8px;
    margin-bottom: 25px; display: block;
}

.preview-img { display: none; border-radius: 5px; border: 1px solid var(--border-color); }
.preview-img.post { width: 150px; height: 100px; object-fit: cover; margin: 10px 0; }
.preview-img.staff { width: 150px; height: auto; object-fit: contain; margin-top: 10px; border-radius: 8px; }
.preview-img.intro { width: 120px; height: 80px; object-fit: cover; margin-bottom: 10px; }

.staff-card {
    background: var(--white); padding: 20px; text-align: center;
    border-radius: var(--border-radius); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border-top: 5px solid var(--primary); width: 250px;
}
.staff-avatar {
    width: 100%; height: 250px; object-fit: cover; object-position: top center;
    margin-bottom: 15px; border-radius: 8px; border: 1px solid var(--border-color);
}

.admin-card {
    background: var(--white); padding: 20px; border-radius: 10px;
    border-top: 5px solid var(--primary); height: 100%;
}

input, select, textarea {
    width: 100%; padding: 10px; margin-bottom: 10px;
    border: 1px solid #ddd; border-radius: 5px; font-size: 14px;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-light), var(--primary-medium));
    color: var(--white); padding: 10px 18px; border: none; border-radius: 5px;
    cursor: pointer; font-weight: bold; transition: 0.3s;
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn-primary:hover {
    background-position: right center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.btn-secondary {
    background: var(--white); 
    color: var(--primary); 
    padding: 9px 17px;
    border: 1px solid var(--primary); 
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold;
    transition: 0.3s;
}
.btn-secondary:hover {
    background: #e3f2fd;
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-edit-post {
    background: var(--warning); color: var(--text-color); padding: 5px 10px;
    border-radius: 4px; font-weight: bold; border: none; cursor: pointer; font-size: 12px;
}
.btn-delete-item {
    background: var(--danger); color: var(--white); padding: 5px 10px;
    border-radius: 4px; border: none; cursor: pointer; font-size: 12px;
}
.post-actions-admin {
    margin-top: 10px; border-top: 1px dashed #ddd; padding-top: 10px;
    display: flex; gap: 8px;
}

.detail-admin-actions {
    display: flex; gap: 20px; margin-bottom: 25px; padding-top: 15px;
    border-top: 1px dashed #ddd; justify-content: flex-start;
}
.detail-action-btn {
    padding: 12px 25px !important; font-size: 15px !important; font-weight: bold;
    border-radius: 6px; display: inline-flex; align-items: center;
    justify-content: center; min-width: 140px; height: 45px;
}
.btn-edit-yellow { background-color: transparent !important; color: var(--white) !important; border: none !important; }
.btn-edit-yellow:hover { opacity: 0.9; }
.btn-delete-red { background-color: var(--danger) !important; color: var(--white) !important; border: none !important; }
.btn-delete-red:hover { background-color: var(--danger-dark) !important; }

/* 5. MODALS & 2FA STYLES */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); display: flex; justify-content: center;
    align-items: center; z-index: 1100; padding: 10px;
}
.modal-content {
    background: var(--white); padding: 25px; width: 100%; max-width: 650px;
    border-radius: var(--border-radius); max-height: 90vh; overflow-y: auto;
}
.modal-buttons.center { justify-content: center; display: flex; gap: 10px; }

/* 2FA specific */
.qr-code {
    width: 200px; height: 200px; margin: 20px auto;
    border: 1px solid var(--border-color); display: block;
}
.secret-text { color: var(--danger); }
.otp-input {
    text-align: center; font-size: 20px; letter-spacing: 5px;
    width: 60%; margin: 0 auto 20px auto; display: block;
}
.otp-input.login { font-size: 24px; width: 100%; }

#post-modal .modal-content, #intro-modal .modal-content {
    background-color: #e9ecef; width: 98%; max-width: 98%;
    height: 98vh; max-height: 98vh;
    margin: 1vh auto; padding-top: 50px; display: flex; flex-direction: column; overflow: hidden;
}

#post-modal .tox-tinymce, #intro-modal .tox-tinymce,
#post-modal input[type="text"], #intro-modal input[type="text"],
#post-modal input[type="file"], #intro-modal input[type="file"],
#post-modal label, #intro-modal label,
#post-modal h3, #intro-modal h3 {
    max-width: 1200px; width: 95%;
    margin-left: auto; margin-right: auto;
}

#post-modal .tox-tinymce, #intro-modal .tox-tinymce { 
    flex-grow: 1; border: 1px solid #ccc; border-radius: 4px; 
}

#post-modal h3, #intro-modal h3 { 
    text-align: left; margin-bottom: 10px; color: var(--primary); 
}

#post-modal .modal-buttons, #intro-modal .modal-buttons {
    position: absolute; top: 15px; right: 30px;
    z-index: 100; margin: 0; background: transparent;
}

/* 6. FOOTER */
.site-footer {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-medium) 100%);
    color: var(--white); padding: 20px; border-top: none;
    width: 100%; margin-top: auto;
}
.site-footer .container {
    padding: 0;
}
.site-footer h3 {
    color: var(--white); border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 10px; margin-bottom: 15px;
}
.site-footer i { color: var(--white); }
.site-footer a { color: #e3f2fd; }

.footer-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px; width: 100%;
}

svg.icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.125em;
    fill: currentColor;
    display: inline-block;
}

/* TÙY CHỈNH THÔNG BÁO */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.custom-toast {
    min-width: 280px;
    padding: 16px 20px;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    border-left: 5px solid;
}

.custom-toast.show {
    transform: translateX(0);
}

/* Màu sắc cho từng loại thông báo */
.custom-toast.success { border-left-color: #4caf50; }
.custom-toast.error { border-left-color: #f44336; }
.custom-toast.info { border-left-color: #2196F3; }
.custom-toast.success i { color: #4caf50; font-size: 1.4rem; }
.custom-toast.error i { color: #f44336; font-size: 1.4rem; }
.custom-toast.info i { color: #2196F3; font-size: 1.4rem; }

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.fa-spin {
    animation: fa-spin 1.5s linear infinite;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-medium);
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 230px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border-radius: 0 0 8px 8px;
    z-index: 1001;
    overflow: hidden;
}

/* GIAO DIỆN MOBILE */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        background: rgba(0, 0, 0, 0.15);
        box-shadow: none;
        width: 100%;
        border-radius: 0;
    }
    
    .dropdown-menu li a {
        padding-left: 40px !important;
        border-left: 4px solid var(--primary-light);
    }

    body { background-image: none; }
	.section-heading { margin-top: 20px; }
    .desktop-only { display: none; }
    .txt-pc { display: none; }
    .txt-mb { display: inline; }
    .site-wrapper { width: 100%; margin: 0; border-radius: 0; box-shadow: none; }
    .container { padding: 0 15px; }
    .main-menu, .site-footer { width: 100%; max-width: 100%; margin: 0; border-radius: 0; }
    .header-layout {
        width: 100%; margin: 0; position: relative;
        left: auto; right: auto; border-radius: 0; box-shadow: none; height: auto;
    }
    .header-right { height: 130px; }
    .header-overlay { padding: 0 10px; text-align: center; }    
    .site-title h1 { 
        font-size: 2.1rem; 
        font-family: 'Segoe UI', Roboto, Arial, sans-serif; 
        font-weight: 800; 
        line-height: 1.3; 
        margin-top: 0; 
    }
    .main-menu .container { flex-wrap: wrap; justify-content: space-between; }    
    .mobile-menu-btn {
        display: flex; align-items: center; gap: 5px; order: 1; background: transparent;
        color: var(--white); border: none; padding: 10px 0; border-radius: 0;
        font-size: 1rem; font-weight: 600; cursor: pointer; margin: 0;
    }
    #auth-action-area { order: 2; margin-left: auto; }
    #nav-list {
        order: 3; width: 100%; flex-direction: column; display: none;
        margin-top: 10px; background: var(--primary-medium); border-radius: 4px; flex-grow: 0;
    }
    #nav-list.show { display: flex; }
    #nav-list li { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.1); }
    #nav-list a { padding-left: 20px; }
    .news-grid, .dashboard-grid, .footer-grid { grid-template-columns: 1fr; gap: 15px; }    
    .post-card { 
        display: flex; 
        flex-direction: row; 
        min-height: 110px; 
        align-items: flex-start;
    }
    .post-card img { 
        width: 110px; 
        min-width: 110px;
        height: 90px; 
        min-height: 90px;
        object-fit: cover; 
        flex-shrink: 0;
        background-color: #e0e0e0;
    }
    .post-content { 
        padding: 10px; 
        width: calc(100% - 110px);
        flex-grow: 1; 
    }
    .post-content h3 { font-size: 1rem; margin-bottom: 5px; }
    .post-actions-admin { flex-direction: column; }
    .btn-edit-post, .btn-delete-item { width: 100%; margin-top: 5px; }
    .modal-content { width: 95%; max-height: 90vh; padding: 15px; }
    #post-modal .modal-content, #intro-modal .modal-content { padding-top: 60px; }
    #post-modal .modal-buttons, #intro-modal .modal-buttons { top: 10px; right: 10px; }
    #post-modal .tox-tinymce, #intro-modal .tox-tinymce { height: 300px !important; flex-grow: 0; }
    .detail-admin-actions { flex-direction: row; justify-content: space-between; gap: 10px; }
    .detail-action-btn { width: 48%; min-width: auto; padding: 10px 5px !important; font-size: 14px !important; margin: 0 !important; }
}

@media (max-width: 480px) {
    .header-right { height: 130px; }
    .site-title h1 { 
        font-size: 1.8rem; 
        line-height: 1.3; 
    }
}

@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        display: block;
    }
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu li a {
    display: block;
    padding: 12px 20px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
    font-weight: 500 !important;
    white-space: normal;
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

.dropdown-menu li a:hover,
.dropdown-menu li a.active {
    background: var(--primary-dark) !important;
    border-radius: 0 !important;
    padding-left: 25px !important;
}