/* Reset básico */
* 

/* Contenedor móvil */

/* Header */
.header {
    background: #1C1450;
    padding: 1rem;
    border-radius: 0 0 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-text {
    display: flex;
    flex-direction: column;
    margin-left: 0.5rem;
}

.brand {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.subtitle {
    color: #FFD700;
    font-size: 0.875rem;
}

/* Menú principal */


.title {
    color: #1C1450;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    margin: 1rem 0;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    background: #c0bebe;
    color: rgb(0, 0, 0);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-item:hover {
    background: #b0b0b0;
    transform: translateY(-1px);
}

.menu-item img {
    width: 24px;
    height: 24px;
    margin-right: 0.5rem;
}

/* Chat y sistema de inspección */
#chat-container {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: white;
}

.chat-header {
    background: #1C1450;
    padding: 1rem;
    display: flex;
    align-items: center;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 0.5rem;
}

#back-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    margin-right: 1rem;
    font-size: 1.5rem;
    padding: 0.5rem;
}

#chat-messages, .checklist-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f9f9;
    height: calc(100vh - 160px);
    scroll-behavior: smooth;
}

/* Mensajes */
.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    word-wrap: break-word;
    font-size: 0.9rem;
}

.user-message {
    background: #1C1450;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background: #e9ecef;
    color: black;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

/* Sistema de inspección */
.checklist-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    overflow: hidden;
}

.km-section {
    background: transparent;
    padding: 0;
    margin: 0.5rem 0;
    box-shadow: none;
}

.km-section label {
    color: #1C1450;
    display: block;
    margin-bottom: 0.5rem;
}

.km-section input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #f5f5f5;
}

/* Quita los botones de incremento en Chrome y Safari */
.km-section input::-webkit-outer-spin-button,
.km-section input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.section-button {
    width: 100%;
    padding: 0.75rem;
    margin: 0.5rem 0;
    border: 1px solid #1C1450;
    border-radius: 8px;
    background: transparent;
    color: #1C1450;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 800;
}

.section-button:hover {
    background: #1C1450;
    color: white;
}

.section-button.completed {
    background-color: #28a745 !important;
}

.section-button.completed:hover {
    background-color: #218838 !important;
}

/* Input y controles */
.chat-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: sticky;
    bottom: 0;
}

#user-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.25rem;
    font-size: 0.9rem;
}

#send-button {
    padding: 0.75rem 1.5rem;
    background: #1C1450;
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
}

/* Adjuntos e imágenes */
.attachment-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #1C1450;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.image-preview {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.attachment-preview {
    position: relative;
    display: inline-block;
}

.remove-button {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: red;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading indicator */
.loading {
    align-self: flex-start;
    background: #e9ecef;
    padding: 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Botones de confirmación */
.button-container {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    gap: 1rem;
}

.confirm-button,
.cancel-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
    flex: 1;
}

.confirm-button {
    background: #1C1450;
    color: white;
}

.confirm-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.cancel-button {
    background: #e0e0e0;
    color: black;
}

/* Submit button */
.submit-button {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    background: rgba(28, 20, 80, 0.5);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: not-allowed;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.submit-button:not(:disabled) {
    background: #1C1450;
    cursor: pointer;
}

.submit-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Extras y utilidades */
.comment-section {
    margin-top: 1rem;
}

.comment-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: bold;
}

.comment-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.25rem;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.message-content {
    margin-top: 10px;
}

.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

/* Radio buttons personalizados */
.form-table input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0 auto;
    padding: 0;
    cursor: pointer;
    border: 1px solid #ccc;
    background: white;
    position: relative;
    display: block;
}

/* Eliminar cualquier pseudo-elemento */
.form-table input[type="radio"]::after,
.form-table input[type="radio"]::before {
    content: none;
}

/* Estados de selección */
.form-table input[type="radio"][value="BUENO"]:checked {
    background-color: #28a745;
    border: none;
}

.form-table input[type="radio"][value="REGULAR"]:checked {
    background-color: #ffc107;
    border: none;
}

.form-table input[type="radio"][value="MALO"]:checked {
    background-color: #dc3545;
    border: none;
}

.form-table input[type="radio"][value="NULO"]:checked {
    background-color: #000000;
    border: none;
}

/* Estilos para la tabla de checkeo */
.form-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    table-layout: fixed;
    background: white;
}

/* Estilos para el encabezado */
.form-table th {
    padding: 8px 2px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: normal;
    white-space: nowrap;
}

/* Ajustar el ancho de las columnas del encabezado */
.form-table th:first-child {
    width: 24%;
    text-align: left;
    padding-left: 12px;
}

.form-table th:not(:first-child) {
    width: 15%;
}

/* Ajustar espacio entre columnas */
.form-table td {
    border: none;
    padding: 8px 2px;
    text-align: left;
    font-size: 0.85rem;
}

/* Mantener el resto de los estilos igual */
.form-table tr:nth-child(even) {
    background-color: #f5f5f5;
}

.form-table tr:nth-child(odd) {
    background-color: white;
}

.form-table tr {
    border-bottom: 1px solid #e0e0e0;
}

.form-table td:first-child {
    width: 35%;
    padding-left: 12px;
}

.form-table td:not(:first-child) {
    text-align: center;
}

/* Ocultar chat input en modo checkeo */
.chat-input-container.hidden {
    display: none;
}

/* Ajuste del contenedor de mensajes para checkeo */
#chat-messages.checkeo-mode {
    padding-bottom: 0;
}

/* Responsividad */
@media screen and (max-width: 400px) {
    .mobile-container {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .menu-item,
    .message,
    #user-input,
    #send-button {
        font-size: 0.8rem;
    }

    .chat-messages {
        height: calc(100vh - 120px);
    }

    .form-table {
        font-size: 0.8rem;
    }

    .image-preview {
        max-width: 120px;
        max-height: 120px;
    }
}

/* Login styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(28, 20, 80, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
}

.login-box h2 {
    color: #1C1450;
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-box input {
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    font-size: 1rem;
}

.login-box button {
    background: #1C1450;
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
}

.login-box p {
    text-align: center;
    margin-top: 1rem;
}

.login-box a {
    color: #1C1450;
    text-decoration: none;
    font-weight: bold;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-top: 1rem;
    display: none;
}

/* Ocultar el contenedor principal cuando se muestra el login */
.mobile-container.hidden {
    display: none;
}

.logout-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    margin-left: auto;
    padding: 0.5rem;
}

.logout-button:hover {
    opacity: 0.8;
}

/* Reset chat button */
#reset-chat-container {
    margin-left: auto;
}

#reset-chat-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

#reset-chat-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Configuración para el contenedor del chat principal */
#main-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 40vh;
    max-height: 40vh;
    overflow: hidden;
    margin: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#main-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
}

.main-chat-input-container {
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    padding: 0.5rem;
    gap: 0.5rem;
}

#main-user-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.9rem;
}

#main-send-button {
    background: #1C1450;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#main-send-button img {
    width: 18px;
    height: 18px;
}

/* Media queries para adaptación a diferentes pantallas */
@media (max-height: 600px) {
    #main-chat-container {
        height: 35vh;
        max-height: 35vh;
    }
}

@media (min-height: 800px) {
    #main-chat-container {
        height: 45vh;
        max-height: 45vh;
    }
}