/* Estilos Generales y Reseteo */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container-fluid { /* Cambiado de .container a .container-fluid para ocupar todo el ancho */
    display: flex;
    flex: 1;
    padding: 0; /* Eliminar padding por defecto del container si es necesario */
}

/* Sidebar - Menú Lateral */
.sidebar {
    width: 250px;
    background-color: #343a40; /* Color oscuro */
    color: white;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100vh; /* Ocupa el 100% de la altura de la vista */
    position: sticky; /* Se mantiene en su lugar al hacer scroll */
    top: 0;
    left: 0;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #495057; /* Separador */
}

.sidebar-header h1 {
    margin: 0;
    font-size: 24px;
    color: #f8f9fa;
}

.flag-icon {
    width: 60px; /* Ajusta el tamaño si es necesario */
    height: auto;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin-top: 10px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    flex-grow: 1; /* Para que ocupe el espacio disponible */
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    color: #dee2e6;
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: #495057;
    color: #ffffff;
}

.sidebar-nav a i {
    margin-right: 10px;
    font-size: 18px;
}

/* Contenido Principal */
.main-content {
    flex: 1; /* Ocupa el espacio restante */
    padding: 30px;
    background-color: #f8f9fa;
    overflow-y: auto; /* Para permitir scroll si el contenido es muy largo */
}

.card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    padding: 25px;
    margin-bottom: 30px;
}

.card-header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 25px;
    font-size: 24px;
    color: #343a40;
    font-weight: bold;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    font-weight: bold;
    color: #555;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 16px;
    color: #495057;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.btn {
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-outline-primary {
    background-color: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    color: white;
}

.btn-outline-secondary {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: white;
}

/* Grid para formularios */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas */
    gap: 20px 30px; /* Espacio entre filas y columnas */
    margin-bottom: 20px;
}

/* Encabezados de sección dentro del formulario */
.form-section-header {
    grid-column: 1 / -1; /* Ocupa ambas columnas */
    font-size: 1.3rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #343a40;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

/* Estilos para la sección de botones */
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Estilos para la tabla */
.table-responsive {
    overflow-x: auto; /* Permite scroll horizontal en tablas grandes */
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background-color: #fff;
}

.table th,
.table td {
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    background-color: #e9ecef;
    color: #495057;
    font-weight: bold;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr:nth-of-type(odd) {
    background-color: #f8f9fa;
}

.table tbody tr:hover {
    background-color: #e2e6ea;
}

.table .btn-sm {
    padding: 5px 10px;
    font-size: 0.875rem;
}

/* Mensajes de alerta/estado */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Estilos de los campos de archivo (subida de documentos) */
.file-upload-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    border: 1px dashed #ced4da;
    padding: 8px;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.file-upload-item .form-control[type="file"] {
    flex-grow: 1; /* Ocupa el espacio disponible */
    margin-right: 10px;
    border: none; /* Quitamos el borde del input file si el contenedor ya lo tiene */
    padding: 0; /* Quitamos padding del input file */
}

/* Estilo para el label del input file que muestra el nombre del archivo */
.file-upload-item .input-group-text {
    flex-grow: 1;
    cursor: pointer;
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    overflow: hidden; /* Ocultar texto largo */
    white-space: nowrap; /* No romper línea */
    text-overflow: ellipsis; /* Mostrar puntos suspensivos */
}
.file-upload-item .input-group-text.selected {
    background-color: #d4edda; /* Verde claro cuando hay archivo */
    color: #155724; /* Texto más oscuro */
}


/* Botón eliminar documento */
.file-upload-item .remove-doc-btn {
    margin-left: 10px;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
}

.file-limit-info {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}

/* Estilos para el listado de documentos ya subidos (en edición) */
.document-item-uploaded {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    padding: 8px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
}

.document-item-uploaded span {
    font-size: 15px;
    color: #343a40;
}

.document-item-uploaded .remove-uploaded-document {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 20px;
    padding: 0 5px;
}
.document-item-uploaded .remove-uploaded-document:hover {
    color: #c82333;
}

/* Estilos para la lista de dependientes */
.dependent-item-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f0f2f5;
    border: 1px solid #dee2e6;
    padding: 8px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
}

.dependent-item-summary span {
    font-size: 15px;
    color: #343a40;
}

.dependent-actions .btn-link {
    margin-left: 10px;
    font-size: 13px;
    text-decoration: none;
    color: #007bff;
}
.dependent-actions .btn-link:hover {
    text-decoration: underline;
}


/* Modal Styles (para Agregar/Editar Familiar) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1050; /* Z-index alto para estar sobre todo */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.5); /* Fondo semitransparente oscuro */
    display: flex; /* Usar flexbox para centrar contenido */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 25px;
    border: 1px solid #888;
    width: 90%; /* Ancho responsivo */
    max-width: 700px; /* Ancho máximo */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh; /* Permitir scroll dentro del modal si el contenido es largo */
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    font-size: 22px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.modal-content h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #495057;
}

.modal-content .close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}

.modal-content .close-button:hover,
.modal-content .close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Estilos para el botón de calendario del input de fecha */
.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.input-group-text i {
    cursor: pointer;
}

/* Responsividad básica */
@media (max-width: 768px) {
    .container-fluid {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative; /* No sticky en móviles */
        padding-bottom: 0;
        border-bottom: 1px solid #495057;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding-top: 10px;
    }
    .sidebar-nav li {
        margin-right: 15px;
        margin-bottom: 10px;
    }
    .main-content {
        padding: 20px;
    }
    .form-grid {
        grid-template-columns: 1fr; /* Una columna en móviles */
        gap: 15px;
    }
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    .form-actions .btn {
        width: 100%;
    }
    .modal-content {
        width: 95%;
        padding: 15px;
    }
}