@import url('https://rsms.me/inter/inter.css');

html {
    font-family: 'Inter', sans-serif;
}

body {
    background-color: #f8fafc;
    color: #334155;
    transition: background-color 0.3s, color 0.3s;
}

/* --- SỬA ĐỔI GIAO DIỆN DANH SÁCH FILE --- */
.file-list-container {
    background-color: white;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

.file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease-in-out;
    width: 100%;
    box-sizing: border-box;
}

.file-list-container>div:last-child .file-row {
    border-bottom: none;
}

div.file-row {
    cursor: pointer;
    background-color: #f3f4ff;
}

div.file-row:hover {
    background-color: #eef2ff;
}

.file-row.selected {
    border-left: 3px solid #7c3aed;
    background-color: #eef2ff;
}

.file-row.selected:hover {
    background-color: #e0e7ff;
}

.file-list-header {
    font-weight: 600;
    font-size: 0.8rem;
    color: #64748b;
    background-color: #f8fafc;
    text-transform: none;
    letter-spacing: normal;
    border-bottom: 1px solid #e2e8f0;
}

.file-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    min-width: 0;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
    font-size: 0.875rem;
    color: #64748b;
}

.file-list-header .file-details>div {
    text-align: center;
}

.detail-col-category {
    width: 210px;
}

.detail-col-category .item-tag {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.detail-col-group {
    width: 100px;
}

.detail-col-time {
    width: 120px;
    text-align: center;
}

.detail-col-source {
    width: 150px;
}

.detail-col-source .item-tag {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

.detail-col-viral {
    width: 60px;
    text-align: center;
}

.col-stt {
    font-weight: 500;
    color: #64748b;
    text-align: center;
    width: 30px;
}

.file-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
}

.file-icon svg {
    width: 18px;
    height: 18px;
}

.file-title-group {
    display: flex;
    flex-direction: column;
}

.file-title {
    font-weight: 600;
    color: #1e293b;
    text-transform: uppercase;
}

.file-subtitle {
    font-size: 0.8rem;
    color: #6b7280;
}

.item-tag {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    display: inline-block;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #7c3aed;
    animation: spin 1s ease infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

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

.control-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.control-input {
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s;
}

select.control-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.control-input:focus,
.control-input.active {
    box-shadow: 0 0 0 3px #ddd6fe;
    outline: none;
    border-color: #8b5cf6;
}

.control-input:disabled {
    background-color: #f1f5f9;
    cursor: not-allowed;
}

.btn {
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn:disabled {
    background-color: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
    border-color: #d1d5db;
}

.btn-primary {
    background-color: #7c3aed;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #6d28d9;
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary.active,
.btn-secondary:hover:not(:disabled) {
    background-color: #e2e8f0;
    border-color: #a78bfa;
}

#source-filter-panel {
    z-index: 10;
    max-height: 300px;
}

#source-filter-panel:not(.hidden) {
    display: flex;
    flex-direction: column;
}

#source-checkbox-list {
    flex: 1 1 auto;
    overflow-y: auto;
}

.source-filter-footer {
    flex-shrink: 0;
    background-color: white;
}

.source-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
}

.source-checkbox-item:hover {
    background-color: #f1f5f9;
}

.source-checkbox-item input {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.source-checkbox-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

#login-box {
    background-color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 400px;
}

#viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
}

/* BỔ SUNG TÍNH NĂNG BẢN TIN: CSS */
#newsletter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 45;
    display: none;
    align-items: center;
    justify-content: center;
}

#newsletter-box {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 700px;
    height: 70vh;
    display: flex;
    flex-direction: column;
}

#newsletter-content {
    padding: 1rem;
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #334155;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    flex-grow: 1;
    resize: none;
    border: none;
    background-color: #f8fafc;
}

#newsletter-content:focus {
    outline: none;
}


#viewer-box {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

#viewer-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#viewer-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#viewer-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    background-color: #f8fafc;
}

.preview-section {
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.preview-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-title {
    font-weight: 600;
    color: #4338ca;
}

.preview-content {
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.preview-content a {
    color: #0ea5e9;
    text-decoration: underline;
}

.preview-content ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
}

.preview-content li {
    margin-bottom: 0.5rem;
}

#refresh-icon.rotating {
    animation: spin 1s linear infinite;
}

.row-checkbox {
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 0.15em solid #cbd5e1;
    border-radius: 0.25rem;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;
    cursor: pointer;
}

.row-checkbox::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #7c3aed;
    transform-origin: bottom left;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.row-checkbox:checked::before {
    transform: scale(1);
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    color: #475569;
}

.page-btn:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: #a78bfa;
}

.page-btn.active {
    background-color: #7c3aed;
    border-color: #7c3aed;
    color: white;
    cursor: default;
}

.page-btn:disabled {
    background-color: #f8fafc;
    color: #cbd5e1;
    cursor: not-allowed;
}

.dark .page-btn {
    background-color: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

.dark .page-btn:hover:not(:disabled) {
    background-color: #374151;
    border-color: #6b7280;
}

.dark .page-btn.active {
    background-color: #6d28d9;
    border-color: #6d28d9;
    color: white;
}

.dark .page-btn:disabled {
    background-color: #111827;
    color: #4b5563;
}

.dark #newsletter-box {
    background-color: #1f2937;
    border-color: #374151;
}

.dark #newsletter-content {
    background-color: #111827;
    color: #e5e7eb;
}

/* ================================================= */
/* <<< CSS CHO GIAO DIỆN TỐI >>> */
/* ================================================= */

.dark body {
    background-color: #111827;
    color: #9ca3af;
}

.dark main {
    color: #d1d5db;
}

.dark .text-slate-900 {
    color: #f9fafb;
}

.dark .text-slate-800 {
    color: #f3f4f6;
}

.dark .bg-white,
.dark #login-box,
.dark #viewer-box,
.dark .file-list-container,
.dark .preview-section {
    background-color: #1f2937;
    border-color: #374151;
}

.dark .btn-secondary {
    background-color: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

.dark .btn-secondary.active,
.dark .btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
    border-color: #6b7280;
}

.dark .control-label,
.dark .file-title {
    color: #f9fafb;
}

.dark .control-input {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark .control-input:focus,
.dark .control-input.active {
    box-shadow: 0 0 0 3px #4c1d95;
    border-color: #a78bfa;
}

.dark select.control-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.dark .control-input:disabled {
    background-color: #374151;
}

.dark div.file-row {
    background-color: #312e75;
}

.dark div.file-row:hover {
    background-color: #37308d;
}

.dark .file-row.selected {
    background-color: #3b33a0;
}

.dark .file-row.selected:hover {
    background-color: #4338ca;
}

.dark .file-list-header {
    background-color: #111827;
    border-color: #374151;
    color: #9ca3af;
}

.dark .col-stt,
.dark .file-details {
    color: #9ca3af;
}

.dark .border-slate-200,
.dark .border-b,
.dark .border-t {
    border-color: #374151;
}

.dark .file-subtitle,
.dark .text-slate-600,
.dark .text-slate-500 {
    color: #d1d5db;
}

.dark #viewer-title {
    color: #f9fafb;
}

.dark #viewer-content {
    background-color: #111827;
}

.dark .preview-title {
    color: #a78bfa;
}

.dark .preview-content {
    color: #e5e7eb;
}

.dark .preview-content a {
    color: #38bdf8;
}

.dark ::-webkit-scrollbar {
    width: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background-color: #6b7280;
}

.dark .source-filter-footer {
    background-color: #1f2937;
}

.dark .source-checkbox-item:hover {
    background-color: #374151;
}

.dark .row-checkbox {
    background-color: #1f2937;
    border-color: #4b5563;
}