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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.user-info button {
    background: rgba(255,255,255,0.2);
    border: 1px solid white;
    color: white;
    padding: 6px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.user-info button:hover {
    background: rgba(255,255,255,0.3);
}

.section {
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Upload Section com borda */
.upload-box {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #f8f9fa;
    margin-bottom: 20px;
}

.upload-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

button[type="submit"],
#upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
    white-space: nowrap;
}

button[type="submit"]:hover,
#upload-btn:hover {
    transform: translateY(-1px);
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    flex: 1;
    min-width: 200px;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    background: white;
    padding: 10px 16px;
    border: 2px dashed #667eea;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    text-align: center;
    font-size: 14px;
}

.file-label:hover {
    background: #f0f0ff;
    border-color: #764ba2;
}

#file-name {
    color: #666;
    font-size: 13px;
}

.upload-section,
.documents-section,
.result-section {
    margin-bottom: 20px;
}

/* Paginação */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Lista de documentos compacta */
.documents-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.document-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    background: white;
}

.document-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(2px);
}

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

.document-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #666;
}

.document-status {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.document-status.completed {
    color: #4caf50;
}

.document-status.processing {
    color: #ff9800;
}

.document-status.error {
    color: #f44336;
}

.document-status::before {
    content: '•';
    font-size: 16px;
}

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

.btn-view,
.btn-delete,
.btn-export,
.btn-copy,
.btn-callback,
.btn-chunks {
    padding: 6px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: inline-block;
}

.btn-view {
    background: #4caf50;
    color: white;
}

.btn-view:hover {
    background: #45a049;
}

.btn-export {
    background: #2196f3;
    color: white;
}

.btn-copy {
    background: #4caf50;
    color: white;
}

.btn-export:hover {
    background: #1976d2;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #da190b;
}

.btn-callback {
    background: #ff9800;
    color: white;
}

.btn-callback:hover {
    background: #f57c00;
}

.btn-chunks {
    background: #9c27b0;
    color: white;
}

.btn-chunks:hover {
    background: #7b1fa2;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

#result-filename {
    font-weight: bold;
    font-size: 16px;
}

#result-time {
    color: #666;
    font-size: 13px;
}

.result-text {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.message.show {
    opacity: 1;
    transform: translateX(0);
}

.message.success {
    background: #4caf50;
}

.message.error {
    background: #f44336;
}

.message.info {
    background: #2196f3;
}

.status-message {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
}

.status-message.processing {
    background: #fff3e0;
    color: #ff9800;
}

.status-message.success {
    background: #e8f5e9;
    color: #4caf50;
}

.status-message.error {
    background: #ffebee;
    color: #f44336;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Estilos para visualização de texto inline */
.text-view-container {
    margin: 8px 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
    }
}

.text-view-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-view-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.text-view-header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.processing-time {
    font-size: 0.85rem;
    opacity: 0.9;
}

.btn-close, .btn-copy {
    background: rgba(255,255,255,0.2);
    border: 1px solid white;
    color: white;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-close:hover, .btn-copy:hover {
    background: rgba(255,255,255,0.3);
}

.btn-copy {
    background: rgba(76, 175, 80, 0.3);
}

.btn-copy:hover {
    background: rgba(76, 175, 80, 0.5);
}

.text-view-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.text-view-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
    color: #212529;
}

/* Media queries */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
        margin: 0;
    }
    
    body {
        padding: 0;
    }
    
    h1 {
        font-size: 1.2rem;
    }
    
    header {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    
    .upload-controls {
        flex-direction: column;
    }
    
    .file-input-wrapper {
        width: 100%;
    }
    
    #upload-btn {
        width: 100%;
    }
    
    .section {
        padding: 15px;
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Estilos para processing mode badges */
.processing-mode {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
    display: inline-block;
}

.processing-mode.sync {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.processing-mode.async {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}