/* ── Folders grid ────────────────────────────────────────── */
.mat-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.mat-folder-item {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.mat-folder-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.14);
    border-color: #14b8a6;
}

.mat-folder-icon {
    font-size: 2rem;
    color: #0284c7;
    margin-bottom: 0.25rem;
}

.mat-folder-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.mat-folder-count {
    font-size: 0.78rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.mat-folder-count i { color: #14b8a6; font-size: 0.72rem; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.mat-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.mat-bc-btn {
    background: none;
    border: none;
    color: #0284c7;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0;
    transition: color 0.15s;
}

.mat-bc-btn:hover { color: #0369a1; }

.mat-bc-sep { color: #cbd5e1; font-size: 0.75rem; }

.mat-bc-current {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.3rem;
}

.page-title i {
    color: #14b8a6;
}

.page-subtitle {
    color: #64748b;
    font-size: 0.95rem;
}

/* Loading state */
#loading-state {
    text-align: center;
    padding: 3rem;
}

#loading-state i {
    font-size: 2rem;
    color: #14b8a6;
}

/* Empty state */
#empty-state {
    display: none;
    background: linear-gradient(135deg, #f0fdfa, #ccfbf1);
    border: 1.5px solid #99f6e4;
    border-radius: 18px;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-icon-wrap {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    border-radius: 16px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.empty-icon-wrap i {
    color: white;
    font-size: 1.6rem;
}

.empty-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #134e4a;
    margin-bottom: 0.5rem;
}

.empty-desc {
    color: #0f766e;
    font-size: 0.9rem;
    max-width: 420px;
    margin: 0 auto;
}

/* Content area */
#content-area {
    display: none;
}

/* Materials grid */
.materiais-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Material card */
.material-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.material-card:hover {
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.12);
    transform: translateY(-2px);
}

.material-card .card-icon {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.4rem;
}

.material-card .card-icon i {
    color: white;
    font-size: 1.3rem;
}

.material-card .card-disciplina {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #14b8a6;
}

.material-card .card-titulo {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.material-card .card-desc {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
    flex: 1;
}

.material-card .btn-visualizar {
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    transition: opacity 0.2s;
}

.material-card .btn-visualizar:hover {
    opacity: 0.88;
}

/* PDF Viewer Modal */
#pdf-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    flex-direction: column;
}

#pdf-modal.open {
    display: flex;
}

#pdf-topbar {
    background: #1e293b;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    border-bottom: 1px solid #334155;
}

#pdf-topbar .topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#pdf-topbar .pdf-disciplina {
    background: rgba(20, 184, 166, 0.2);
    color: #2dd4bf;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

#pdf-topbar .pdf-titulo-text {
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
}

#pdf-topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#pdf-page-info {
    color: #94a3b8;
    font-size: 0.82rem;
}

#btn-fechar-pdf {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
}

#btn-fechar-pdf:hover {
    background: rgba(255, 255, 255, 0.2);
}

#pdf-pages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    user-select: none;
    -webkit-user-select: none;
}

#pdf-pages-container canvas {
    display: block;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.pdf-inner-loading {
    color: white;
    text-align: center;
    padding: 3rem;
}

.pdf-inner-loading p {
    margin-top: 1rem;
    color: #94a3b8;
    font-size: 0.9rem;
}

.pdf-error {
    color: #f87171;
    text-align: center;
    padding: 3rem;
    font-size: 0.95rem;
}

.pdf-error i {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

/* Filters */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-wrap i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.88rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.65rem 0.9rem 0.65rem 2.4rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    background: white;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #14b8a6;
}

.sort-select {
    padding: 0.65rem 0.9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #1e293b;
    outline: none;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sort-select:focus {
    border-color: #14b8a6;
}

.chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.chip {
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.chip:hover {
    border-color: #14b8a6;
    color: #14b8a6;
}

.chip.active {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: white;
    border-color: transparent;
}

.results-info {
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 1.25rem;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #64748b;
    grid-column: 1 / -1;
}

.no-results i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
    display: block;
}

/* Pagination */
.paginacao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pg-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 0.6rem;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pg-btn:hover:not(:disabled) {
    border-color: #14b8a6;
    color: #14b8a6;
}

.pg-btn.active {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: white;
    border-color: transparent;
}

.pg-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pg-ellipsis {
    color: #94a3b8;
    padding: 0 0.2rem;
}

/* ══════════════════════════════════════════════
   DARK MODE — materiais.css
   ══════════════════════════════════════════════ */
[data-theme="dark"] .mat-folder-item {
    background: #111d2e;
    border-color: #1e3550;
    color: #e2e8f0;
}

[data-theme="dark"] .mat-folder-item:hover {
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.18);
    border-color: #14b8a6;
}

[data-theme="dark"] .mat-folder-name {
    color: #e2e8f0;
}

[data-theme="dark"] .mat-folder-count {
    color: #94a3b8;
}

[data-theme="dark"] .mat-bc-btn {
    color: #3b82f6;
}

[data-theme="dark"] .mat-bc-btn:hover {
    color: #60a5fa;
}

[data-theme="dark"] .mat-bc-sep {
    color: #1e3550;
}

[data-theme="dark"] .mat-bc-current {
    color: #e2e8f0;
}

[data-theme="dark"] .page-title {
    color: #e2e8f0;
}

[data-theme="dark"] .page-subtitle {
    color: #94a3b8;
}

[data-theme="dark"] #empty-state {
    background: linear-gradient(135deg, #111d2e, #19273a);
    border-color: #1e3550;
}

[data-theme="dark"] .empty-title {
    color: #e2e8f0;
}

[data-theme="dark"] .empty-desc {
    color: #94a3b8;
}

[data-theme="dark"] .material-card {
    background: #111d2e;
    border-color: #1e3550;
    color: #e2e8f0;
}

[data-theme="dark"] .material-card:hover {
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.16);
}

[data-theme="dark"] .material-card .card-titulo {
    color: #e2e8f0;
}

[data-theme="dark"] .material-card .card-desc {
    color: #94a3b8;
}

[data-theme="dark"] .search-input {
    background: #19273a;
    border-color: #1e3550;
    color: #e2e8f0;
}

[data-theme="dark"] .search-input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .search-input:focus {
    border-color: #3b82f6;
}

[data-theme="dark"] .search-wrap i {
    color: #64748b;
}

[data-theme="dark"] .sort-select {
    background: #19273a;
    border-color: #1e3550;
    color: #e2e8f0;
}

[data-theme="dark"] .sort-select:focus {
    border-color: #3b82f6;
}

[data-theme="dark"] .chip {
    background: #19273a;
    border-color: #1e3550;
    color: #94a3b8;
}

[data-theme="dark"] .chip:hover {
    border-color: #14b8a6;
    color: #14b8a6;
}

[data-theme="dark"] .chip.active {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    border-color: transparent;
}

[data-theme="dark"] .results-info {
    color: #94a3b8;
}

[data-theme="dark"] .no-results {
    color: #64748b;
}

[data-theme="dark"] .no-results i {
    color: #1e3550;
}

[data-theme="dark"] .pg-btn {
    background: #19273a;
    border-color: #1e3550;
    color: #94a3b8;
}

[data-theme="dark"] .pg-btn:hover:not(:disabled) {
    border-color: #14b8a6;
    color: #14b8a6;
}

[data-theme="dark"] .pg-btn.active {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    color: #fff;
    border-color: transparent;
}

[data-theme="dark"] .pg-ellipsis {
    color: #64748b;
}
