/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

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

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

/* Secciones */
.auth-section,
.controls-section,
.files-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Autenticación */
.auth-success {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.auth-login {
    text-align: center;
}

.auth-login p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #6c757d;
}

.status-indicator {
    color: #28a745;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-execute {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-execute:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

.btn-link {
    background: linear-gradient(45deg, #17a2b8, #138496);
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
    text-decoration: none;
}

.btn-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(23, 162, 184, 0.3);
}

/* Controles */
.folder-input {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.folder-input label {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

/* 🆕 Estilos para el botón de abrir carpeta */
#openFolderBtn {
    background: linear-gradient(45deg, #fd7e14, #e96500);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

#openFolderBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(253, 126, 20, 0.4);
    background: linear-gradient(45deg, #e96500, #d63900);
}

.input-field {
    flex: 1;
    min-width: 300px;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Files Section */
.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.files-header h2 {
    color: #495057;
    font-size: 1.8rem;
    margin: 0;
}

.files-count {
    padding: 8px 15px;
    background: #e9ecef;
    border-radius: 20px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.files-table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.files-table th,
.files-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.files-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.files-table tr:hover {
    background: #f8f9fa;
}

.file-type {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.file-type.excel {
    background: #d4edda;
    color: #155724;
}

.file-type.sheets {
    background: #cce7f0;
    color: #0c5460;
}

/* Mensajes */
.error-message,
.success-message {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .folder-input {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-field {
        min-width: auto;
    }
    
    .files-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .files-table th,
    .files-table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .auth-success {
        flex-direction: column;
        text-align: center;
    }
}