/* Media Library Component */
.media-library-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.media-library-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-library-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    height: 80%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.media-library-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
}

.media-library-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.media-library-close {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.media-library-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Filtros e Controles */
.media-controls {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    background: white;
}

.media-search {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.media-search input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.media-search input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.media-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

.media-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.media-filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.media-upload-btn {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.media-upload-btn:hover {
    background: #7c3aed;
}

/* Lista de Arquivos */
.media-library-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.media-item {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.media-item:hover {
    border-color: #8b5cf6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.media-item.selected {
    border-color: #8b5cf6;
    background: #f3f4ff;
}

.media-item-preview {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    position: relative;
    overflow: hidden;
}

.media-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-item-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-file-icon {
    width: 48px;
    height: 48px;
    color: #8b5cf6;
}

.media-item-info {
    padding: 0.75rem;
}

.media-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-item-details {
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.media-item-type {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 500;
}

/* Badges por tipo de arquivo */
.media-item-type.video {
    background: #fee2e2;
    color: #dc2626;
}

.media-item-type.audio {
    background: #fef3c7;
    color: #d97706;
}

.media-item-type.pdf {
    background: #dbeafe;
    color: #2563eb;
}

.media-item-type.document {
    background: #d1fae5;
    color: #059669;
}

.media-item-type.image {
    background: #f3e8ff;
    color: #8b5cf6;
}

/* Duração do arquivo */
.media-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Empty State */
.media-empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.media-empty-state svg {
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.media-empty-state h3 {
    font-size: 1.125rem;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.media-empty-state p {
    margin: 0;
}

/* Loading State */
.media-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
}

.media-loading svg {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Footer com ações */
.media-library-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.media-selected-info {
    font-size: 0.9rem;
    color: #6b7280;
}

.media-actions {
    display: flex;
    gap: 0.75rem;
}

.media-action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.media-action-btn.primary {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

.media-action-btn.primary:hover {
    background: #7c3aed;
}

.media-action-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Upload Zone */
.media-upload-zone {
    margin: 1rem 0;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.media-upload-zone.drag-over {
    border-color: #8b5cf6;
    background: #f3f4ff;
}

.media-upload-zone input[type="file"] {
    display: none;
}

.media-upload-text {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.media-upload-button {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.media-upload-button:hover {
    background: #7c3aed;
}

/* Responsivo */
@media (max-width: 768px) {
    .media-library-content {
        width: 95%;
        height: 85%;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .media-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .media-search {
        max-width: none;
        margin-bottom: 0.5rem;
    }
    
    .media-filters {
        justify-content: space-between;
    }
}

/* Estatísticas */
.media-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.85rem;
}

.media-stat {
    flex: 1;
    text-align: center;
}

.media-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.media-stat-label {
    color: #6b7280;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}