/* =========================================
   ECO-S: Estilos Globales - Objetos Recuperados
   ========================================= */

:root {
    --primary-color: #005A43; /* Verde Institucional */
    --secondary-color: #F2A900; /* Dorado/Amarillo */
    --bg-light: #F8F9FA;
    --text-main: #333333;
    --text-muted: #6C757D;
    --white: #FFFFFF;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
}

/* Barra de navegación principal */
.navbar {
    display: flex;
    justify-content: space-between; /* Separa el bloque de la marca a la izquierda y el botón a la derecha */
    align-items: center;            /* Centra verticalmente los elementos */
    padding: 12px 30px;            /* Relleno interno armónico */
    background-color: #005A43;      /* Verde institucional EAN */
    color: #ffffff;
}

/* Agrupador de Logo + Título */
.navbar-brand {
    display: flex;
    align-items: center;            /* Alinea verticalmente el logo con el texto */
    gap: 15px;                      /* Espacio horizontal entre el logo y el título */
}

/* Estilo optimizado para el Logo EAN */
.logo-ean {
    height: 42px;                   /* Altura proporcional para barra superior */
    width: auto;                    /* Mantiene la proporción aspecto original */
    object-fit: contain;
    display: block;
}

/* Estilo del título */
.navbar-brand h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
    white-space: nowrap;            /* Evita que el título se parta en dos líneas */
}

/* Botón administrativo */
.btn-admin {
    padding: 8px 18px;
    border: 1px solid #ffffff;
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.btn-admin:hover {
    background-color: #ffffff;
    color: #005A43;
}
/* --- Contenedores y Alertas --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.alert-info {
    background-color: #E8F5E9;
    border-left: 5px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.alert-info strong {
    color: var(--primary-color);
}

/* --- Barra de Filtros --- */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.form-control {
    padding: 0.75rem 1rem;
    border: 1px solid #CED4DA;
    border-radius: 4px;
    font-size: 1rem;
    flex: 1;
    min-width: 200px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: #004231;
}

/* --- Cuadrícula de Objetos --- */
.objects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.object-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.object-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.card-image-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.object-card:hover .card-image-wrapper img {
    transform: scale(1.1);
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tag-category {
    background-color: #E9ECEF;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card-title {
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.card-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.btn-reclamar {
    background-color: var(--secondary-color);
    color: #000;
    border: none;
    padding: 0.75rem;
    width: 100%;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    margin-top: auto;
}

.btn-reclamar:hover {
    background-color: #d19200;
}

/* =========================================
   Módulo de Autenticación (Login)
   ========================================= */

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-light);
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    padding: 3rem 2.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.auth-footer a:hover {
    color: var(--secondary-color);
}

.error-message {
    background-color: #F8D7DA;
    color: #721C24;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: none; /* Se oculta por defecto */
    border-left: 4px solid #F5C6CB;
}


/* =========================================
   Panel de Administración (Dashboard)
   ========================================= */

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-light);
}

/* Menú Lateral */
.sidebar {
    width: 250px;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 2rem 1rem;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 1rem;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    display: block;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--secondary-color);
}

.btn-logout {
    margin-top: auto;
    background-color: #d93025;
    color: white;
    text-align: center;
}

.btn-logout:hover {
    background-color: #b02a1f;
}

/* Contenido Principal */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Tarjetas de Resumen */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-bottom: 4px solid var(--primary-color);
}

.stat-card h3 {
    margin: 0;
    font-size: 2rem;
    color: var(--primary-color);
}

.stat-card p {
    margin: 0.5rem 0 0 0;
    color: var(--text-muted);
    font-weight: 600;
}

/* Tablas Responsivas */
.table-container {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto; /* Permite scroll horizontal en móviles */
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #E9ECEF;
}

.data-table th {
    background-color: #F8F9FA;
    color: var(--primary-color);
    font-weight: 600;
}

.data-table tbody tr:hover {
    background-color: #F8F9FA;
}

/* Botones de acción pequeña en tabla */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    color: white;
}

.btn-baja { background-color: #6C757D; }
.btn-edit { background-color: var(--secondary-color); color: #000; }
.btn-delete { background-color: #d93025; }

/* ==========================================
   ADAPTACIÓN PARA MÓVILES Y TABLETS (≤ 768px)
   ========================================== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
        text-align: center;
    }

    .navbar-brand {
        flex-direction: column;
        gap: 10px;
    }

    .navbar-brand h1 {
        font-size: 1.2rem;
        white-space: normal; /* Permite que el título se divida en 2 líneas si la pantalla es muy estrecha */
        text-align: center;
    }

    .logo-ean {
        height: 38px; /* Tamaño optimizado para pantalla móvil */
    }

    .btn-admin {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 10px;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Desplazamiento suave e inercial en iOS/Android */
}
/* =========================================
   Ventanas Modales (Formularios superpuestos)
   ========================================= */

.modal-overlay {
    display: none; /* Esta es la línea mágica que oculta el formulario */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto; /* Centrado extra de seguridad */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-close:hover {
    color: #d93025;
}

/* ==========================================================
   Ecosistema ECO-S: Animación e Identificación Espacial
   Efecto Hover Zoom para miniaturas de objetos recuperados
   ========================================================== */

.img-miniatura-zoom {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
    cursor: zoom-in;
}

/* Ampliación focalizada al pasar el cursor */
.img-miniatura-zoom:hover {
    transform: scale(4.5);
    position: relative;
    z-index: 1050; /* Garantiza que sobrepase la capa de la tabla */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    border-radius: 6px;
}
