/**
 * Files Tab Enhancements - Phase 1 Quick Wins
 * Styles for improved file management UI
 */

/* =======================
   Breadcrumb Navigation
   ======================= */
.files-header .breadcrumb {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.files-header .breadcrumb-item {
    font-size: 0.875rem;
}

.files-header .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.25rem;
    color: #6c757d;
}

.files-header .breadcrumb-link {
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.2s;
}

.files-header .breadcrumb-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* =======================
   File Preview Modal
   ======================= */
.file-preview-modal .file-preview-container {
    max-height: 75vh;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #f8f9fa;
    padding: 0.5rem;
}

.file-preview-iframe {
    width: 100%;
    height: 75vh;
    border: none;
    border-radius: 0.375rem;
}

.file-preview-image {
    max-width: 100%;
    height: auto;
    max-height: 75vh;
    display: block;
    margin: 0 auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-preview-text {
    background: #ffffff;
    padding: 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 75vh;
    overflow: auto;
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.file-preview-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
}

.file-preview-popup {
    padding: 1.5rem !important;
}

/* =======================
   Upload Progress
   ======================= */
.upload-progress-container {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-progress-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
    border-left: 3px solid #0d6efd;
}

.upload-progress-item .progress {
    background-color: #e9ecef;
}

.upload-status {
    font-weight: 500;
}

/* =======================
   File Table Enhancements
   ======================= */
.fileTable {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    overflow: hidden;
}

.fileTable thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.fileTable thead th {
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
}

.fileTable tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.fileTable tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
}

.file-row {
    cursor: pointer;
}

.folder-row {
    background-color: #fffbf0;
}

.folder-row:hover {
    background-color: #fff3cd;
}

.file-link {
    color: #212529;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.file-link:hover {
    color: #0d6efd;
    text-decoration: underline;
}

/* =======================
   File Icons
   ======================= */
.fileTable td:first-child {
    font-size: 1.25rem;
}

.fa-file-pdf {
    color: #dc3545;
}

.fa-file-image {
    color: #17a2b8;
}

.fa-file-excel {
    color: #28a745;
}

.fa-file-word {
    color: #0d6efd;
}

.fa-file-invoice-dollar {
    color: #ffc107;
}

.fa-folder {
    color: #fd7e14;
    font-size: 1.125rem;
}

/* =======================
   Action Buttons - Professional Design
   ======================= */
.fileTable .btn-group {
    gap: 0.375rem;
    display: flex;
}

.fileTable .btn-group .btn {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background-color: #f8f9fa;
    color: #6c757d;
}

.fileTable .btn-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fileTable .btn-group .btn:active {
    transform: translateY(0);
}

/* Preview button - Blue */
.fileTable .previewEfileButton {
    background-color: #e7f3ff;
    color: #0d6efd;
}

.fileTable .previewEfileButton:hover {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* Download button - Green */
.fileTable .downloadEfileButton {
    background-color: #e8f5e9;
    color: #28a745;
}

.fileTable .downloadEfileButton:hover {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* Rename button - Gray */
.fileTable .renameEfileButton {
    background-color: #f8f9fa;
    color: #6c757d;
}

.fileTable .renameEfileButton:hover {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

/* Delete button - Red */
.fileTable .deleteEfileButton {
    background-color: #ffebee;
    color: #dc3545;
}

.fileTable .deleteEfileButton:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* =======================
   Header Enhancements
   ======================= */
.efileHeading {
    font-weight: 600;
    color: #495057;
}

.efileHeading i {
    color: #0d6efd;
}

.files-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* =======================
   Empty State
   ======================= */
.text-center .fa-folder-open,
.text-center .fa-folder-plus {
    color: #cbd5e1;
}

/* =======================
   Drag and Drop
   ======================= */
.fileTable.table-primary {
    background-color: #e7f3ff !important;
    border: 2px dashed #0d6efd;
}

.fileTable.table-primary tbody tr {
    background-color: #e7f3ff;
}

/* =======================
   Rename Input Group
   ======================= */
.rename-input-group {
    margin-top: 0.5rem;
}

.rename-input-group .input-group {
    max-width: 400px;
}

/* =======================
   Mobile Responsiveness
   ======================= */
@media (max-width: 768px) {
    .files-header .row > div {
        margin-bottom: 0.75rem;
    }

    .files-header .col-md-4 {
        text-align: center !important;
    }

    .fileTable {
        font-size: 0.875rem;
    }

    .fileTable thead th {
        padding: 0.5rem 0.375rem;
        font-size: 0.7rem;
    }

    .fileTable tbody td {
        padding: 0.5rem 0.375rem;
    }

    .btn-group-sm .btn {
        padding: 0.2rem 0.3rem;
        font-size: 0.75rem;
    }

    .btn-group-sm .btn i {
        font-size: 0.875rem;
    }

    /* Stack action buttons vertically on very small screens */
    @media (max-width: 576px) {
        .btn-group {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }

        .btn-group .btn {
            width: 100%;
            border-radius: 0.25rem !important;
        }
    }

    .file-preview-iframe {
        height: 50vh;
    }

    .file-preview-modal {
        font-size: 0.875rem;
    }

    .breadcrumb {
        font-size: 0.75rem;
    }
}

/* =======================
   Touch-Friendly Targets
   ======================= */
@media (hover: none) and (pointer: coarse) {
    /* Mobile/touch devices */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .folderLink,
    .file-link {
        padding: 0.5rem 0;
        display: inline-block;
    }

    .breadcrumb-link {
        padding: 0.25rem 0.5rem;
        display: inline-block;
    }
}

/* =======================
   Loading States
   ======================= */
.spinner-border {
    color: #0d6efd;
}

/* =======================
   Accessibility
   ======================= */
.btn:focus,
.breadcrumb-link:focus,
.file-link:focus,
.folderLink:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* =======================
   Print Styles
   ======================= */
@media print {
    .files-header .btn,
    .btn-group {
        display: none;
    }

    .fileTable {
        box-shadow: none;
    }
}

/* =======================
   Dark Mode Support
   ======================= */
@media (prefers-color-scheme: dark) {
    .files-header .breadcrumb {
        background-color: #2d3748;
    }

    .file-preview-container {
        background: #1a202c;
        border-color: #4a5568;
    }

    .file-preview-text {
        background: #2d3748;
        color: #e2e8f0;
    }

    .file-preview-navigation {
        background: #2d3748;
    }

    .upload-progress-item {
        background: #2d3748;
    }

    .fileTable {
        background-color: #1a202c;
    }

    .fileTable tbody tr:hover {
        background-color: #2d3748;
    }

    .folder-row {
        background-color: #2d3748;
    }

    .folder-row:hover {
        background-color: #374151;
    }
}
