* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --light-gray: #f3f4f6;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 5px;
}

/* Upload Section */
.upload-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--light-gray);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--light-gray);
    transform: scale(1.02);
}

.upload-area svg {
    color: var(--primary);
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
}

.upload-hint {
    color: var(--gray);
    font-size: 0.9rem;
}

/* API Key Section */
.api-key-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-section label {
    font-weight: 600;
    white-space: nowrap;
}

.api-key-section input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.api-key-section input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Upload Meta Section (Tags e Descrição) */
.upload-meta-section {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    flex-direction: column;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Progress Bar */
.progress-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.progress-bar {
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
    color: var(--primary);
}

/* Files Section */
.files-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.section-header h2 {
    font-size: 1.5rem;
    color: var(--dark);
}

/* Filters Section */
.filters-section {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.3s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-group button {
    width: 100%;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--light-gray);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.file-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.file-preview {
    width: 100%;
    height: 200px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.file-preview img,
.file-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview svg {
    width: 64px;
    height: 64px;
    color: var(--gray);
}

.file-info {
    padding: 15px;
}

.file-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 10px;
}

.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
    min-height: 24px;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag:empty {
    display: none;
}

.file-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.file-actions button {
    flex: 1;
    min-width: 80px;
    padding: 8px;
    font-size: 0.8rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
}

.modal-close:hover {
    color: var(--dark);
}

#modalBody img,
#modalBody video {
    max-width: 100%;
    border-radius: 8px;
}

#modalBody audio {
    width: 100%;
    margin-top: 20px;
}

/* Edit Form */
.edit-form {
    margin-top: 20px;
}

.edit-form h2 {
    margin-bottom: 20px;
    color: var(--dark);
}

.edit-form .form-group {
    margin-bottom: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-actions button {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* Pagination */
.pagination-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 600;
}

.pagination-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-buttons button {
    min-width: 100px;
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--light-gray);
    color: var(--gray);
}

.pagination-buttons button:disabled:hover {
    background: var(--light-gray);
    transform: none;
}

.pagination-current {
    padding: 10px 15px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .api-key-section {
        flex-direction: column;
        align-items: stretch;
    }

    .files-grid {
        grid-template-columns: 1fr;
    }

    .pagination-buttons {
        flex-direction: column;
        width: 100%;
    }

    .pagination-buttons button {
        width: 100%;
    }
}
