/* ===========================
   File Manager Component Styles
   Document upload and management
   =========================== */

/* File Upload Modal */
.file-upload-container {
    padding: 10px 0;
}

.upload-category-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--color-light);
    border-radius: 8px;
    margin-bottom: 24px;
}

.category-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border-radius: 50%;
    background: white;
}

.category-details {
    flex: 1;
}

.category-details h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.category-details p {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.category-details .allowed-types {
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Upload Form */
.upload-form {
    padding: 0 8px;
}

.upload-form .form-group {
    margin-bottom: 20px;
}

.upload-form .form-group:last-child {
    margin-bottom: 0;
}

.upload-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.upload-form label .required {
    color: var(--color-danger);
    margin-left: 4px;
}

.upload-form .form-input,
.upload-form .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.upload-form .form-input:focus,
.upload-form .form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.upload-form textarea.form-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* File Input Wrapper */
.file-input-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-input-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    background: var(--color-light);
    cursor: pointer;
    transition: all 0.3s;
    min-height: 160px;
}

.file-input-display:hover {
    border-color: var(--color-primary);
    background: rgba(74, 144, 226, 0.05);
}

.file-input-display i {
    font-size: 48px;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.file-input-text {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.file-input-name {
    display: none;
    margin-top: 12px;
    padding: 8px 16px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    color: var(--color-text);
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Upload Progress */
.upload-progress {
    margin-top: 20px;
    padding: 16px;
    background: var(--color-light);
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* File List */
.file-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.file-list-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.file-list-empty p {
    margin: 0;
    font-size: 14px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* File Item */
.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.2s;
}

.file-item:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.file-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--color-light);
    border-radius: 8px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.file-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-meta i {
    font-size: 12px;
}

.file-desc {
    margin-top: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.file-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text-secondary);
}

.file-action-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.file-action-btn.delete:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: white;
}

/* File Attachments Section in Views */
.attachments-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.attachments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.attachments-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachments-header h3 i {
    color: var(--color-primary);
}

.attachments-header .badge {
    margin-left: 8px;
}

.btn-upload-file {
    padding: 8px 16px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-upload-file:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.btn-upload-file i {
    font-size: 13px;
}

/* Compact File List for View Modals */
.file-list.compact .file-item {
    padding: 12px;
    gap: 12px;
}

.file-list.compact .file-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
}

.file-list.compact .file-name {
    font-size: 14px;
}

.file-list.compact .file-meta {
    font-size: 12px;
    gap: 8px;
}

.file-list.compact .file-action-btn {
    width: 32px;
    height: 32px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .upload-category-info {
        flex-direction: column;
        text-align: center;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .file-meta {
        flex-direction: column;
        gap: 4px;
    }

    .attachments-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-upload-file {
        width: 100%;
        justify-content: center;
    }
}

/* Animation for file upload */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-item {
    animation: slideInUp 0.3s ease-out;
}

/* File type specific colors */
.file-icon[data-type="pdf"] {
    color: #E74C3C;
}

.file-icon[data-type="word"] {
    color: #2B579A;
}

.file-icon[data-type="excel"] {
    color: #217346;
}

.file-icon[data-type="image"] {
    color: #9B59B6;
}

.file-icon[data-type="archive"] {
    color: #F39C12;
}
