/* FILES.CSS - Estilos para a seção de Arquivos */

/* ==================== PÁGINA DE ARQUIVOS ==================== */

.files-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.files-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    color: #666;
    font-size: var(--font-size-md);
}

/* ==================== HEADER ==================== */

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.files-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-base);
    color: #666;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: #666;
}

.breadcrumb-item:hover {
    background: #f0f0f0;
    color: var(--color-primary);
}

.breadcrumb-item.active {
    color: #333;
    font-weight: 500;
    cursor: default;
}

.breadcrumb-item.active:hover {
    background: transparent;
}

.breadcrumb-root {
    color: var(--color-primary);
}

.breadcrumb-root svg {
    width: 18px;
    height: 18px;
}

.breadcrumb-separator {
    color: #ccc;
}

.files-actions {
    display: flex;
    gap: 12px;
}

.btn-files-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    background: transparent;
    color: var(--color-primary);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-files-action:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    border-color: var(--color-primary);
}

.btn-files-action.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.btn-files-action.btn-primary:hover {
    background: #5a00d6;
    border-color: #5a00d6;
}

.btn-files-action svg {
    width: 18px;
    height: 18px;
}

/* ==================== GRID DE ARQUIVOS ==================== */

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.files-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.files-empty svg {
    color: #ccc;
    margin-bottom: 16px;
}

.files-empty h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: var(--font-size-lg);
}

.files-empty p {
    margin: 0;
    font-size: var(--font-size-base);
    color: #666;
}

/* ==================== CARDS DE ARQUIVO/PASTA ==================== */

.file-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.folder-card:hover {
    background: #f8f8f8;
}

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    color: #888;
}

.folder-icon {
    color: #ffc107 !important;
}

.file-type-image {
    color: #4caf50 !important;
}

.file-type-pdf {
    color: #f44336 !important;
}

.file-type-word {
    color: #2196f3 !important;
}

.file-type-excel {
    color: #4caf50 !important;
}

.file-type-ppt {
    color: #ff9800 !important;
}

.file-type-video {
    color: #9c27b0 !important;
}

.file-type-audio {
    color: #e91e63 !important;
}

.file-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.file-name {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: #333;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.file-meta {
    font-size: var(--font-size-sm);
    color: #888;
}

.file-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-card:hover .file-actions {
    opacity: 1;
}

.file-download-btn,
.file-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.file-download-btn:hover {
    background: var(--color-primary);
    color: white;
}

.file-delete-btn:hover {
    background: #ef4444;
    color: white;
}

/* ==================== MODAL DE ARQUIVOS ==================== */

.files-modal {
    max-width: 500px;
    width: 90%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.files-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.files-modal .modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: #333;
}

.files-modal .modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.files-modal .modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.files-modal form {
    padding: 24px;
}

.files-modal .form-group {
    margin-bottom: 20px;
}

.files-modal .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: #333;
}

.files-modal .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: var(--font-size-base);
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.files-modal .form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.files-modal .form-group input::placeholder {
    color: #999;
}

.files-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.files-modal .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.files-modal .btn-secondary {
    background: #f0f0f0;
    border: 1px solid #ddd;
    color: #333;
}

.files-modal .btn-secondary:hover {
    background: #e0e0e0;
}

.files-modal .btn-primary {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: white;
}

.files-modal .btn-primary:hover {
    background: #5a00d6;
}

/* ==================== UPLOAD ZONE ==================== */

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed #ccc;
    border-radius: 12px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.05);
}

.upload-zone svg {
    color: #888;
    margin-bottom: 16px;
}

.upload-zone p {
    margin: 0 0 8px 0;
    font-size: var(--font-size-base);
    color: #333;
}

.upload-hint {
    font-size: var(--font-size-sm);
    color: #888;
}

/* ==================== ARQUIVOS SELECIONADOS ==================== */

.selected-files {
    margin-top: 20px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 8px;
}

.selected-files h4 {
    margin: 0 0 12px 0;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: #333;
}

.selected-files ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.selected-files li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.selected-files li:last-child {
    border-bottom: none;
}

.file-list-name {
    font-size: var(--font-size-sm);
    color: #333;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-size {
    font-size: var(--font-size-sm);
    color: #888;
}

/* ==================== BARRA DE PROGRESSO ==================== */

.upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.upload-progress-bar-container {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), #8b5cf6);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.upload-progress-text {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #333;
    min-width: 40px;
    text-align: right;
}

/* ==================== MODAL OVERLAY ==================== */

#newFolderModal,
#uploadFileModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ==================== DARK MODE ==================== */

[data-theme="dark"] .files-loading {
    color: #a0a0a0;
}

[data-theme="dark"] .files-breadcrumb {
    color: #a0a0a0;
}

[data-theme="dark"] .breadcrumb-item {
    color: #a0a0a0;
}

[data-theme="dark"] .breadcrumb-item:hover {
    background: #252545;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #e0e0e0;
}

[data-theme="dark"] .breadcrumb-separator {
    color: #444;
}

[data-theme="dark"] .files-empty {
    color: #a0a0a0;
}

[data-theme="dark"] .files-empty h3 {
    color: #e0e0e0;
}

[data-theme="dark"] .file-card {
    background: #1e1e1e;
    border-color: #3a3a5c;
}

[data-theme="dark"] .folder-card:hover {
    background: #252545;
}

[data-theme="dark"] .file-icon {
    color: #888;
}

[data-theme="dark"] .file-name {
    color: #e0e0e0;
}

[data-theme="dark"] .file-meta {
    color: #888;
}

[data-theme="dark"] .file-download-btn,
[data-theme="dark"] .file-delete-btn {
    background: #252545;
    color: #a0a0a0;
}

[data-theme="dark"] .files-modal {
    background: #1a1a2e;
}

[data-theme="dark"] .files-modal .modal-header {
    border-color: #3a3a5c;
}

[data-theme="dark"] .files-modal .modal-header h3 {
    color: #e0e0e0;
}

[data-theme="dark"] .files-modal .modal-close {
    color: #a0a0a0;
}

[data-theme="dark"] .files-modal .form-group label {
    color: #e0e0e0;
}

[data-theme="dark"] .files-modal .form-group input {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #3a3a5c;
}

[data-theme="dark"] .files-modal .btn-secondary {
    background: #252545;
    color: #e0e0e0;
}

[data-theme="dark"] .upload-zone {
    border-color: #444;
    background: #1e1e1e;
}

[data-theme="dark"] .upload-zone p {
    color: #e0e0e0;
}

[data-theme="dark"] .upload-hint {
    color: #888;
}

[data-theme="dark"] .selected-files {
    background: #252545;
}

[data-theme="dark"] .selected-files h4 {
    color: #e0e0e0;
}

[data-theme="dark"] .selected-files li {
    border-color: #3a3a5c;
}

[data-theme="dark"] .file-list-name {
    color: #e0e0e0;
}

[data-theme="dark"] .upload-progress-bar-container {
    background: #3a3a5c;
}

[data-theme="dark"] .upload-progress-text {
    color: #e0e0e0;
}

[data-theme="dark"] .file-viewers-modal {
    background: #1a1a2e;
}

[data-theme="dark"] .file-viewers-modal-header {
    background: #252545;
    border-color: #3a3a5c;
}

[data-theme="dark"] .file-viewers-modal-header h3 {
    color: #e0e0e0;
}

[data-theme="dark"] .file-viewers-modal-close {
    color: #a0a0a0;
}

[data-theme="dark"] .file-viewer-item:hover {
    background: #252545;
}

[data-theme="dark"] .file-viewer-name {
    color: #e0e0e0;
}

/* ==================== RESPONSIVO ==================== */

@media (max-width: 768px) {
    .files-page {
        padding: 16px;
    }

    .files-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .files-actions {
        width: 100%;
    }

    .btn-files-action {
        flex: 1;
        justify-content: center;
    }

    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .file-card {
        padding: 16px 12px;
    }

    .file-icon {
        width: 48px;
        height: 48px;
    }

    .file-icon svg {
        width: 36px;
        height: 36px;
    }

    .file-actions {
        opacity: 1;
    }

    .btn-files-action span {
        display: none;
    }

    .btn-files-action {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .file-name {
        font-size: 12px;
    }

    .file-meta {
        font-size: 10px;
    }
}

/* ==================== VISUALIZADOR DE ARQUIVOS ==================== */

.file-view-btn,
.file-rename-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(var(--color-primary-rgb), 0.1);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-view-btn:hover,
.file-rename-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.2);
}

.file-view-btn svg,
.file-rename-btn svg {
    stroke: var(--color-primary);
}

/* Modal de renomear */
.rename-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}

.rename-input-wrapper input {
    flex: 1;
    padding: 12px;
    border: none;
    font-size: var(--font-size-base);
    outline: none;
    background: var(--color-bg-card, #fff);
    color: var(--color-text, #333);
}

.rename-input-wrapper .file-extension {
    padding: 12px;
    background: var(--color-bg, #f8f9fa);
    color: var(--color-text-light, #666);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-left: 1px solid var(--color-border, #e0e0e0);
}

.file-viewer-modal {
    z-index: var(--z-modal, 1050);
}

.file-viewer-content {
    background: var(--color-bg-card, #fff);
    border-radius: 16px;
    width: 95%;
    max-width: 1200px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.file-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
    background: var(--color-bg, #f8f9fa);
}

.file-viewer-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-text, #333);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.file-viewer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-viewer-download {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(var(--color-primary-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-viewer-download:hover {
    background: rgba(var(--color-primary-rgb), 0.2);
}

.file-viewer-download svg {
    stroke: var(--color-primary);
}

.file-viewer-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-viewer-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.file-viewer-close svg {
    stroke: var(--color-text, #333);
}

.file-viewer-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: #1a1a1a;
    min-height: 400px;
}

/* Imagem */
.file-viewer-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

/* PDF */
.file-viewer-pdf {
    width: 100%;
    height: 80vh;
    border: none;
}

/* Vídeo */
.file-viewer-video {
    max-width: 100%;
    max-height: 80vh;
}

/* Áudio */
.file-viewer-audio-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.audio-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.audio-name {
    color: #fff;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 30px;
}

.file-viewer-audio {
    width: 100%;
    max-width: 400px;
}

/* Tipo não suportado */
.file-viewer-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.unsupported-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.unsupported-name {
    color: #fff;
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 10px;
}

.unsupported-message {
    color: #999;
    font-size: var(--font-size-base);
    margin-bottom: 30px;
}

/* Responsivo */
@media (max-width: 768px) {
    .file-viewer-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .file-viewer-body {
        min-height: calc(100vh - 70px);
    }

    .file-viewer-pdf {
        height: calc(100vh - 70px);
    }
}

/* ==================== SISTEMA VISTO POR ULTIMO ==================== */

/* Indicador de visualizacoes no card do arquivo */
.file-viewers-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin-top: 8px;
    border: none;
    border-radius: 4px;
    background: rgba(var(--color-primary-rgb), 0.08);
    color: var(--color-primary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-viewers-indicator:hover {
    background: rgba(var(--color-primary-rgb), 0.15);
}

.file-viewers-indicator svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.file-viewers-count {
    font-weight: 500;
    white-space: nowrap;
}

/* Modal de Visualizadores de Arquivo */
.file-viewers-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-tooltip, 1070);
    padding: 20px;
}

.file-viewers-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    animation: slideInModal 0.3s ease;
}

@keyframes slideInModal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-viewers-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.file-viewers-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: #333;
}

.file-viewers-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-viewers-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.file-viewers-modal-body {
    padding: 12px;
    max-height: calc(80vh - 70px);
    overflow-y: auto;
}

.file-viewers-loading {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: var(--font-size-base);
}

.file-viewers-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.file-viewers-empty p {
    margin: 0;
    font-size: var(--font-size-base);
}

/* Lista de visualizadores */
.file-viewers-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-viewer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.file-viewer-item:hover {
    background: #f5f5f5;
}

.file-viewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.file-viewer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.file-viewer-name {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-viewer-time {
    font-size: var(--font-size-sm);
    color: #888;
}

/* Responsivo para viewers */
@media (max-width: 768px) {
    .file-viewers-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .file-viewers-modal-body {
        max-height: calc(100vh - 70px);
    }
}

@media (max-width: 480px) {
    .file-viewers-indicator {
        font-size: 10px;
        padding: 3px 6px;
    }

    .file-viewer-avatar {
        width: 36px;
        height: 36px;
    }

    .file-viewer-name {
        font-size: 13px;
    }
}
