/* =========================================
   RESET Y CONFIGURACIÓN BASE
   ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

/* =========================================
   LAYOUT PRINCIPAL (Tarjeta Única)
   ========================================= */

/* Wrapper para evitar que se pegue a los bordes en pantallas pequeñas */
.main-wrapper {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

/* La tarjeta contenedora principal */
.dashboard-card {
    background: #fff;
    width: 100%;
    max-width: 1100px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
    display: flex; /* Flexbox para dividir en columnas */
    flex-direction: row;
    overflow: hidden; /* Mantiene los bordes redondeados */
}

/* =========================================
   SECCIONES INTERNAS (Izquierda / Derecha)
   ========================================= */

/* Estilos comunes de bloque */
.section-block {
    flex: 1; /* 50% de ancho cada uno */
    padding: 3rem;
    display: flex;
    flex-direction: column;
}

/* SECCIÓN IZQUIERDA: Formulario */
.upload-section {
    background-color: #fff;
    border-right: 1px solid #f0f0f0; /* Línea divisoria vertical */
    justify-content: center;
    align-items: center;
}

/* Contenedor interno del formulario para limitar el ancho visual */
.form-content {
    width: 100%;
    max-width: 350px;
    text-align: center;
}

/* SECCIÓN DERECHA: Listado */
.list-section {
    background-color: #fcfcfc; /* Fondo ligeramente diferente opcional */
}

.list-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Área con scroll para los archivos */
.scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    max-height: 500px;
    padding-right: 10px; /* Espacio para barra de scroll */
}

/* =========================================
   ELEMENTOS DEL FORMULARIO
   ========================================= */
h2, h3 { color: #2c3e50; font-weight: 600; margin-top: 0; }
h2 { margin-bottom: 1.5rem; }
h3 { margin-bottom: 1.5rem; font-size: 1.2em; border-bottom: 2px solid #eee; padding-bottom: 10px;}

input[type="text"], input[type="password"], input[type="file"] {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    background: #fafafa;
    transition: 0.3s;
}

input:focus { border-color: #3498db; outline: none; background: #fff; }

.file-upload-wrapper {
    border: 2px dashed #ddd;
    padding: 25px;
    border-radius: 8px;
    background: #fafafa;
    margin-bottom: 15px;
    transition: 0.2s;
}
.file-upload-wrapper:hover { border-color: #3498db; background: #f0f8ff; }

button {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
    transition: 0.3s;
    font-weight: 500;
}
button:hover { background-color: #2980b9; }

.nav-links { margin-top: 25px; font-size: 0.9em; display: block; }
.nav-links a { color: #7f8c8d; text-decoration: none; margin: 0 8px; transition:0.2s;}
.nav-links a:hover { color: #3498db; }

/* =========================================
   ITEMS DE LISTA (Diseño Vertical)
   ========================================= */
.file-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column; /* Apilar elementos verticalmente */
    align-items: flex-start;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.file-item:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); border-color:#dcdcdc;}

/* Encabezado: Icono + Nombre */
.file-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 5px;
}

.file-name {
    font-weight: 600;
    color: #34495e;
    font-size: 0.95em;
    word-break: break-all;
}

/* Fecha (debajo del nombre) */
.file-date {
    font-size: 0.8em;
    color: #95a5a6;
    margin-left: 30px; /* Indentación visual alineada al texto */
    margin-bottom: 15px; /* Espacio antes de los botones */
}

/* Fila de Botones (debajo de la fecha) */
.file-actions-row {
    display: flex;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

/* Estilos de botones pequeños de acción */
.btn-action {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex; align-items: center; gap: 8px;
    width: auto; /* Reset del width:100% global */
    margin-top: 0;
    font-weight: 500;
}

/* Botón: Usar por defecto */
.btn-set-default { background: #f1f2f6; color: #57606f; border: 1px solid #dfe4ea; }
.btn-set-default:hover { background: #dfe4ea; color: #2f3542; }

/* Botón: Eliminar */
.btn-delete-full { background: #fff5f5; color: #e74c3c; border: 1px solid #fadbd8; }
.btn-delete-full:hover { background: #fadbd8; color: #c0392b; }

/* Badge: En uso */
.badge-active {
    background: #e3f9e5; color: #219653; border: 1px solid #c3e6cb;
    padding: 8px 14px; border-radius: 6px; font-size: 0.85em; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px;
}

/* =========================================
   ALERTAS Y MODALES
   ========================================= */
.alert { padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9em; display: none; text-align: left; line-height: 1.4; }
.alert-error { background-color: #fde8e8; color: #c0392b; border: 1px solid #fadbd8; }
.alert-success { background-color: #def7e5; color: #27ae60; border: 1px solid #c3e6cb; }

/* Modal Overlay */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: none; justify-content: center; align-items: center;
}
.modal-content {
    background: white; padding: 2.5rem; border-radius: 12px; width: 90%; max-width: 350px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: popIn 0.3s ease;
}
.modal-actions { margin-top: 25px; display: flex; gap: 15px; justify-content: center; }
.btn-modal { width: auto; padding: 10px 20px; margin: 0; }
.btn-confirm { background: #e74c3c; }
.btn-cancel { background: #95a5a6; }

/* Loader */
.loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95); z-index: 9999;
    display: none; justify-content: center; align-items: center; flex-direction: column;
}
.spinner {
    width: 50px; height: 50px; border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db; border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 15px;
}
.loader-text { color: #3498db; font-weight: 600; font-size: 1.1em; letter-spacing: 1px; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* =========================================
   RESPONSIVE (Móviles)
   ========================================= */
@media (max-width: 900px) {
    .dashboard-card {
        flex-direction: column; /* Apilar verticalmente */
        max-width: 500px;
    }
    
    .upload-section {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 2rem;
    }
    
    .list-section {
        padding: 2rem;
        background: #fff; /* En móvil se ve mejor todo blanco */
    }

    .scroll-area {
        max-height: 400px;
    }
}

/* IDENTIDAD DE MARCA (Header) */
.app-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px; /* Separación del título de la sección */
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0; /* Línea sutil divisoria */
    width: 100%;
}

.brand-icon {
    font-size: 2rem;
    color: #3498db; /* Azul corporativo */
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}
.brand-name span {
    color: #3498db; /* "Box" en azul o "Signa" en azul, a tu gusto */
}