:root {
    --red: #990303; --red-d: #7a0202; --text: #1a1a1a; --gray: #6b7280;
    --light: #f5f6f8; --border: #e5e7eb; --white: #ffffff; --trans: .18s ease;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Be Vietnam Pro', sans-serif; background: var(--light); color: var(--text); min-height: 100vh; padding: 28px 16px 48px; }
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }

/* ═══════════════════════════════════════════
            HEADER & ACTIONS
═══════════════════════════════════════════ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 20px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 9px; }
.page-title i { color: var(--red); font-size: 20px; }
.page-count { font-size: 13px; color: var(--gray); font-weight: 400; margin-left: 4px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-input { border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 12px 8px 36px; font-size: 13px; outline: none; background: var(--white); width: 100%; transition: all var(--trans); color: var(--text); }
.search-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(153, 3, 3, .08); }
.search-icon { position: absolute; left: 11px; color: #b0b7c3; font-size: 13px; pointer-events: none; }

.btn-header { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--border); background: var(--white); color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--trans); opacity: .8; }
.btn-header:hover, .btn-header.active { border-color: var(--red); color: var(--red); }
.btn-header--primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn-header--primary:hover { background: var(--red-d); border-color: var(--red-d); color: #fff; }
/* Nút resetFilters: mờ khi chưa có filter, sáng + viền đỏ + chữ đỏ khi có filter đang bật */
.btn-header.is-active { opacity: 1; border-color: var(--red); color: var(--red); }
.select2-container .select2-selection--single {
    height: 38px;
    border-radius: 8px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {    
    line-height: 38px;
    font-size: 13px;
}
/* ═══════════════════════════════════════════
            DROPDOWN FILTERS & TABS
═══════════════════════════════════════════ */
.dropdown-filters { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 20px; display: flex; flex-wrap: wrap; box-shadow: 0 2px 8px rgba(0,0,0,0.02);align-items: flex-end;row-gap:10px}
.df-item { flex: 1; }
.df-item label { display: block; font-size: 12px; font-weight: 700; color: var(--gray); margin-bottom: 6px; text-transform: uppercase; }
.df-select { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; outline: none; transition: border-color var(--trans); }
.df-select:focus { border-color: var(--red); }

.filter-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 0; overflow-x: auto; background: var(--white); border-radius: 12px 12px 0 0; padding: 0 8px; }
.filter-tabs::-webkit-scrollbar { display: none; }
.ftab { padding: 13px 16px; font-size: 13px; font-weight: 600; color: var(--gray); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -2px; background: none; border-top: none; border-left: none; border-right: none; transition: all var(--trans); flex-shrink: 0; display: flex;align-items: center}
.ftab:hover, .ftab.active { color: var(--red); }
.ftab.active { border-bottom-color: var(--red); font-weight: 700; }

/* ═══════════════════════════════════════════
            TABLE STYLES
═══════════════════════════════════════════ */
.table-card { background: var(--white); border-radius: 0 0 12px 12px; border: 1px solid var(--border); border-top: none; overflow: hidden; box-shadow: 0 2px 12px rgba(0, 0, 0, .05); }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table thead th { padding: 12px 16px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--gray); background: var(--light); border-bottom: 1.5px solid var(--border); white-space: nowrap; cursor: pointer; }
.doc-table thead th:first-child {padding-left: 20px; .ts-tableth:first-child;position: sticky;left: 0;z-index: 1;transition: background .1s;}
.doc-table thead th:last-child { padding-right: 20px; text-align: center; }

.th-sortable { display: inline-flex; align-items: center; gap: 5px; }
.th-sortable i { font-size: 10px; color: #c4c9d4; transition: color var(--trans); }
.doc-table thead th:hover .th-sortable i, .doc-table thead th.sorted .th-sortable i { color: var(--red); opacity: 1; }

.doc-table tbody tr { border-bottom: 1px solid #f3f4f6; transition: background var(--trans); }
.doc-table tbody tr:hover { background: #fafbff; }
.doc-table tbody td { padding: 13px 16px; font-size: 13px; vertical-align: middle; }
.doc-table tbody td:first-child {padding-left: 20px;padding-left: 16px;position: sticky;left: 0;z-index: 1;background: #fff;border-right: 1px solid var(--ts-gray-100);transition: background .1s;}
.doc-table tbody td:last-child { padding-right: 20px; }

/* ═══════════════════════════════════════════
            GRID (CARD) STYLES
═══════════════════════════════════════════ */
.doc-cards { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); 
    gap: 20px; 
    padding: 20px; 
    background: #f8fafc; 
    border-radius: 0 0 12px 12px;
}
.doc-table-wrap { display: block !important; }

.empty-grid-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
}

.doc-card { 
    background: var(--white); 
    border: 1px solid var(--border); 
    border-radius: 14px; 
    padding: 0; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05); 
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    overflow: hidden; 
}
.doc-card:hover { 
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.1), 0 8px 12px -6px rgba(0, 0, 0, 0.05); 
    transform: translateY(-4px); 
    border-color: #cbd5e1;
}

.dc-top { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 16px 12px; gap: 12px; }
.dc-title { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; }
.dc-name { 
    font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.45; cursor: pointer; transition: color var(--trans);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; word-break: break-word;
}
.dc-name:hover { color: var(--red); }

.dc-more-btn { background: transparent; border: none; color: #94a3b8; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; flex-shrink: 0; transition: background 0.2s, color 0.2s; }
.dc-more-btn:hover { background: #f1f5f9; color: var(--text); }

.dc-meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 16px; flex: 1; align-content: flex-start; }
.doc-card .u-badge { padding: 4px 9px; font-size: 11px; }

.dc-row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 12px 16px; background: #f8fafc; border-top: 1px solid var(--border); }
.dc-info { display: flex; align-items: center; font-size: 11.5px; color: var(--gray); font-weight: 500; }
.dc-actions { display: flex; align-items: center; gap: 6px; }
.u-action-btn--sm { width: 28px; height: 28px; font-size: 12px; }

/* ═══════════════════════════════════════════
            COMPONENTS & UTILITIES
═══════════════════════════════════════════ */
.doc-name-cell {display: flex;align-items: flex-start;gap: 11px;}
.doc-name-cell:hover .u-file-ico { transform: scale(1.08); }
.doc-name-text { font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; transition: color var(--trans); line-height: 1.35; }
.doc-name-text:hover { color: var(--red); }
.td-date { font-size: 13px; color: var(--text); white-space: nowrap; }
.td-size { font-size: 13px; color: var(--gray); white-space: nowrap; font-weight: 500; }
.td-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

.u-file-ico { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 0px; font-weight: 800; color: #fff; flex-shrink: 0; letter-spacing: .3px; transition: transform var(--trans); }
.u-file-ico--pdf:before { color: #e53e3e;
    content: "\f1c1";
    font-size: 25px; } .u-file-ico--pptx { background: #dd6b20; } .u-file-ico--xlsx { background: #38a169; } .u-file-ico--docx { background: #3182ce; }
.u-file-ico--youtu\.be:before {content: "\f16a";font-size: 25px;color: var(--red);}

.u-file-ico--video:before{
    content: "\f16a";
    font-size: 25px;
}
.u-file-ico--folder:before {
    color: #e5913e;
    content: "\f07b";
    font-size: 25px;
}
.u-file-ico--post:before {
    color: #3f908c;
    content: "\f1ea";
    font-size: 25px;
}
.u-file-ico--image:before {
    color: #3ea4e5;
    content: "\f03e";
    font-size: 25px;
}

.u-file-ico--video {
    color: var(--red);
    border-radius: 50%
}

.u-file-ico--google\.file:before,
.u-file-ico--file:before {
    content: "\f0f6";
    font-size: 25px;
    color: #0183ff;
}

.u-file-ico--user\.fh:before {
    content: "\f1ea";
    font-size: 23px;
    color: grey
}
.u-badge { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.u-badge--phan-khu { background: rgba(37, 99, 235, .10); color: #2563eb; border: 1px solid rgba(37, 99, 235, .18); }
.u-badge--cs-ban-hang { background: rgba(22, 163, 74, .10); color: #15803d; border: 1px solid rgba(22, 163, 74, .18); }
.u-badge--presentation { background: rgba(124, 58, 237, .10); color: #7c3aed; border: 1px solid rgba(124, 58, 237, .18); }
.u-badge--bang-gia { background: rgba(217, 119, 6, .10); color: #b45309; border: 1px solid rgba(217, 119, 6, .18); }
.u-badge--cs-vay { background: rgba(14, 165, 233, .10); color: #0284c7; border: 1px solid rgba(14, 165, 233, .18); }
.u-badge--mat-bang { background: rgba(236, 72, 153, .10); color: #be185d; border: 1px solid rgba(236, 72, 153, .18); }

.u-action-btn { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--border); background: var(--white); color: var(--gray); font-size: 13px; cursor: pointer; transition: all var(--trans); flex-shrink: 0; }
.u-action-btn:hover { border-color: var(--red); color: var(--red); background: rgba(153, 3, 3, .04); transform: translateY(-1px); }

/* Pagination */
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--white); border-radius: 0 0 12px 12px; flex-wrap: wrap; gap: 12px; }
.tf-info { font-size: 13px; color: var(--gray); }
.tf-info strong { color: var(--text); font-weight: 700; }
.pagination-wrap { display: flex; align-items: center; gap: 5px; }
.pg-btn { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--border); background: var(--white); font-size: 12.5px; font-weight: 600; color: var(--gray); cursor: pointer; transition: all var(--trans); border: none; }
.pg-btn:hover { border-color: var(--red); color: var(--red); }
.pg-btn.active { background: var(--red); border-color: var(--red); color: #fff; }
.pg-btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* Context Menu */
.ctx-menu { position: absolute; z-index: 999; background: var(--white); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .13); padding: 6px 0; min-width: 160px; display: none; }
.ctx-item { display: flex; align-items: center; gap: 9px; padding: 9px 14px; font-size: 13px; color: var(--text); cursor: pointer; transition: all var(--trans); }
.ctx-item i { width: 16px; text-align: center; color: var(--gray); font-size: 13px; }
.ctx-item:hover { background: rgba(153, 3, 3, .05); color: var(--red); }
.ctx-item.danger { color: #e53e3e; } .ctx-item.danger:hover { background: rgba(229, 62, 62, .06); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Angular Toasts */
.angular-toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; background: #fff; border-radius: 10px; padding: 13px 18px; box-shadow: 0 8px 28px rgba(0,0,0,.15); display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; color: #1a1a1a; transition: all .25s ease; }
.angular-toast.ng-enter { opacity: 0; transform: translateY(10px); }
.angular-toast.ng-enter-active { opacity: 1; transform: translateY(0); }
.angular-toast.ng-leave { opacity: 1; transform: translateY(0); }
.angular-toast.ng-leave-active { opacity: 0; transform: translateY(10px); }

/* ═══════════════════════════════════════════
        ANGULARJS ANIMATION (Chống giật/nháy)
═══════════════════════════════════════════ */
@keyframes rowFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.doc-table tbody tr.ng-enter, 
.doc-card.ng-enter { animation: rowFadeIn 0.35s ease both; }

.doc-table tbody tr.ng-enter-stagger, 
.doc-card.ng-enter-stagger { animation-delay: 0.05s; animation-duration: 0s; }

.doc-table tbody tr.ng-leave, 
.doc-card.ng-leave { display: none !important; }

/* ═══════════════════════════════════════════
            RESPONSIVE TỔNG HỢP
═══════════════════════════════════════════ */
@media (max-width: 991px) { .doc-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); padding: 16px; gap: 16px; } }
@media (max-width: 900px) { .col-dung-luong { display: none; } }
@media (max-width: 767px) {
    .doc-cards { display: grid !important; }
    .table-card { border-radius: 12px; border-top: 1px solid var(--border); }
    .search-input { width: 100%; } .search-wrap { flex: 1; } .header-actions { width: 100%; }
}
@media (max-width: 575px) { .doc-cards { grid-template-columns: 1fr; padding: 12px 0; background: transparent; } }