/* ==========================================================================
   style.css — Theme "Huyết Lâu" (đỏ máu / kính mờ / Times New Roman)
   Chuyển thể từ file tieusu.html gốc, dùng chung cho toàn bộ site + khu quản trị.
   ========================================================================== */

:root {
    --blood-red: #dc2626;
    --dark-blood: #991b1b;
    --glass-bg: rgba(20, 0, 0, 0.6);
    --glass-border: rgba(220, 38, 38, 0.4);
}

* {
    font-family: 'Times New Roman', Times, serif !important;
    box-sizing: border-box;
}

body {
    background-color: #050000;
    color: #f87171;
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

a { text-decoration: none; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.5); }
::-webkit-scrollbar-thumb { background: var(--dark-blood); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--blood-red); }

.ma-dao-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(220, 38, 38, 0.1);
    border-radius: 0;
    transition: all 0.3s ease;
}

.ma-dao-glass:hover {
    border-color: rgba(220, 38, 38, 0.7);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.8), inset 0 0 25px rgba(220, 38, 38, 0.2);
}

.text-glow {
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.8), 0 0 20px rgba(220, 38, 38, 0.4);
}

.fire-text {
    color: #ffcccc;
    animation: blood-fire-flicker 0.15s ease-in-out infinite alternate;
}

@keyframes blood-fire-flicker {
    0%, 100% {
        text-shadow: 0 -2px 4px #ff9999, 0 -4px 10px #ff0000, 0 -8px 20px #cc0000, 0 -12px 40px #880000;
    }
    50% {
        text-shadow: 0 -2px 4px #ff9999, 0 -5px 12px #ff0000, 0 -10px 25px #cc0000, 0 -16px 50px #880000;
    }
}

.bg-fixed-layer {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #1a0000 0%, #000000 100%);
    z-index: -1;
    overflow: hidden;
}

.stars-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.star-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.star-layer-1 {
    background-image:
        radial-gradient(1px 1px at 10% 20%, white, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 60% 10%, rgba(255,255,255,0.8), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 75% 25%, white, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 35% 55%, rgba(255,255,255,0.7), rgba(0,0,0,0));
    background-size: 200px 200px;
    animation: twinkle 4s infinite alternate;
    opacity: 0.5;
}

.star-layer-2 {
    background-image:
        radial-gradient(2px 2px at 40% 10%, rgba(200,200,255,0.9), rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 80% 20%, white, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 10% 60%, rgba(255,200,200,0.8), rgba(0,0,0,0));
    background-size: 300px 300px;
    animation: twinkle 3s infinite alternate-reverse;
}

.star-layer-3 {
    background-image:
        radial-gradient(3px 3px at 50% 20%, rgba(180, 100, 255, 0.9), rgba(0,0,0,0)),
        radial-gradient(2.5px 2.5px at 25% 40%, rgba(255, 100, 100, 0.8), rgba(0,0,0,0));
    background-size: 400px 400px;
    animation: twinkle 2s infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 0.8; }
    100% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 5px rgba(255,255,255,0.5); }
}

.shooting-star {
    position: absolute;
    width: 150px; height: 2px;
    background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(180, 100, 255, 0.8) 30%, rgba(180, 100, 255, 0) 100%);
    opacity: 0;
    transform: rotate(-45deg);
}

.shooting-star::before {
    content: '';
    position: absolute;
    left: -2px; top: -1.5px; width: 5px; height: 5px;
    background: white; border-radius: 0;
    box-shadow: 0 0 15px 4px rgba(180, 100, 255, 0.9);
}

@keyframes shooting-star-fall {
    0% { transform: translate(0, 0) rotate(-45deg); opacity: 1; }
    15% { transform: translate(-1200px, 1200px) rotate(-45deg); opacity: 0; }
    100% { transform: translate(-1200px, 1200px) rotate(-45deg); opacity: 0; }
}

.star-1 { top: 0%; left: 80%; animation: shooting-star-fall 6s linear infinite; animation-delay: 0s; }
.star-2 { top: -20%; left: 50%; animation: shooting-star-fall 8s linear infinite; animation-delay: 3.5s; }
.star-3 { top: 20%; left: 100%; animation: shooting-star-fall 7s linear infinite; animation-delay: 5s; }

.nav-active {
    color: #fff !important;
    text-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444;
    border-bottom: 2px solid #ef4444;
    padding-bottom: 2px;
}

/* ------------------------ Nav dropdown (chuyên mục cha-con) ------------------------ */
/* Bình thường chỉ hiện tên chuyên mục cha; bấm vào (nav-dropdown.js
   thêm class "open") mới sổ ra danh sách con. Không dùng :hover vì cách đó
   không hoạt động trên thiết bị cảm ứng và khiến cha bị bấm nhầm điều hướng
   trước khi kịp thấy danh sách con. */

.nav-dropdown-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.6rem;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 190px;
    z-index: 30;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: flex;
}

.nav-dropdown-link {
    color: #f87171;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.4rem 0.6rem;
    white-space: nowrap;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-dropdown-link:hover {
    color: #fff;
    text-shadow: 0 0 8px #ef4444;
}

.nav-dropdown-link-all {
    border-bottom: 1px solid rgba(239, 68, 68, 0.25);
    margin-bottom: 0.15rem;
    padding-bottom: 0.5rem;
}

/* ------------------------ Timeline (danh sách bài viết) ------------------------ */

.timeline-container { position: relative; }

.timeline-line::before {
    content: '';
    position: absolute;
    left: 23px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, rgba(220,38,38,0.05), rgba(220,38,38,0.6) 10%, rgba(220,38,38,0.6) 90%, rgba(220,38,38,0.05));
}

@media (max-width: 767px) {
    .timeline-line::before { left: 19px; }
}

/* ------------------------ Blog / bài viết ------------------------ */

.post-content { line-height: 1.9; font-size: 1.05rem; color: rgba(254, 202, 202, 0.9); }
.post-content p { margin-bottom: 1.1em; }
.post-content strong { color: #fca5a5; }
.post-content img { max-width: 100%; height: auto; border: 1px solid var(--glass-border); margin: 1em 0; }

.btn-blood {
    background: rgba(153, 27, 27, 0.35);
    border: 1px solid var(--blood-red);
    color: #fecaca;
    padding: 0.5rem 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: bold;
    font-size: 0.85rem;
    display: inline-block;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-blood:hover {
    background: var(--blood-red);
    color: #fff;
    box-shadow: 0 0 15px rgba(220,38,38,0.6);
}

.btn-blood-outline {
    background: transparent;
    border: 1px solid rgba(220,38,38,0.5);
    color: #f87171;
}

.btn-blood-outline:hover {
    background: rgba(220,38,38,0.15);
    border-color: var(--blood-red);
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--glass-border);
    color: #f87171;
    margin: 0 0.15rem;
}

.pagination a:hover { border-color: var(--blood-red); color: #fff; }
.pagination .current { background: var(--dark-blood); color: #fff; border-color: var(--blood-red); }

/* ------------------------ Form / khu quản trị ------------------------ */

.admin-input,
.admin-textarea,
.admin-select {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    color: #fecaca;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
}

.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
    outline: none;
    border-color: var(--blood-red);
    box-shadow: 0 0 10px rgba(220,38,38,0.3);
}

.admin-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #ef4444;
    margin-bottom: 0.35rem;
}

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
    border-bottom: 1px solid rgba(220,38,38,0.25);
    padding: 0.75rem 0.6rem;
    text-align: left;
    font-size: 0.9rem;
}
.admin-table th {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: #ef4444;
}
.admin-table tr:hover td { background: rgba(220,38,38,0.06); }

.flash-message {
    padding: 0.85rem 1.1rem;
    border: 1px solid;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}
.flash-success { background: rgba(22,101,52,0.25); border-color: #16a34a; color: #bbf7d0; }
.flash-error { background: rgba(127,29,29,0.35); border-color: #dc2626; color: #fecaca; }

.status-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    border: 1px solid;
}
.status-published { color: #bbf7d0; border-color: #16a34a; }
.status-draft { color: #fde68a; border-color: #ca8a04; }

/* ------------------------ Trình soạn thảo bài viết (Quill) ------------------------ */

.admin-quill-editor { background: rgba(0,0,0,0.5); }

.ql-toolbar.ql-snow {
    background: rgba(20, 0, 0, 0.85) !important;
    border: 1px solid var(--glass-border) !important;
    border-bottom: none !important;
}

.ql-container.ql-snow {
    border: 1px solid var(--glass-border) !important;
    min-height: 320px;
    font-size: 1rem;
}

.ql-editor {
    min-height: 320px;
    color: #fecaca !important;
    font-family: 'Times New Roman', Times, serif !important;
}

.ql-editor.ql-blank::before {
    color: rgba(254, 202, 202, 0.4) !important;
    font-style: normal;
}

.ql-editor img { max-width: 100%; height: auto; border: 1px solid var(--glass-border); }

.ql-snow .ql-stroke { stroke: #f87171 !important; }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: #f87171 !important; }
.ql-snow .ql-picker { color: #f87171 !important; }
.ql-snow .ql-picker-options {
    background: #1a0000 !important;
    border: 1px solid var(--glass-border) !important;
}
.ql-snow .ql-picker-item:hover, .ql-snow .ql-picker-label:hover {
    color: var(--blood-red) !important;
}
.ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--blood-red) !important; }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke { stroke: var(--blood-red) !important; }
.ql-snow.ql-toolbar button.ql-active,
.ql-snow .ql-toolbar button.ql-active { background: rgba(220,38,38,0.2); }

.ql-snow .ql-tooltip {
    background: #1a0000 !important;
    border: 1px solid var(--glass-border) !important;
    color: #fecaca !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7) !important;
}
.ql-snow .ql-tooltip input[type=text] {
    background: rgba(0,0,0,0.6) !important;
    color: #fecaca !important;
    border: 1px solid var(--glass-border) !important;
}
.ql-snow .ql-tooltip a.ql-action, .ql-snow .ql-tooltip a.ql-remove { color: #f87171 !important; }
