:root {
    --bg-color: #4c2d8b;
    --chat-bg: #ffffff;
    --gallery-bg: #e6dff6;
    --agent-msg-bg: #e6f7e9;
    --user-msg-bg: #001f5a;
    --header-bg: #6a44b5;
    --text-color: #333;
    --light-text: #ffffff;
    --send-button-bg: #8c52ff;
    --mic-button-bg: #b3ffb3;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    overflow: hidden;
}

.body-login {
    display: flex;
    align-items: center;
    justify-content: center;
}

.body-chat {
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    background-color: var(--header-bg);
    color: var(--light-text);
    flex-shrink: 0;
}

.header-left, .header-right { flex: 1; }
.header-center { flex: 2; text-align: center; }
.header-right { text-align: right; }

/* Estilos para estado de sincronización */
#syncStatus {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    transition: color 0.3s ease;
}

#syncStatus.sync-enabled {
    color: #28a745;
}

#syncStatus.sync-disabled {
    color: #dc3545;
}

.logo-placeholder {
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
}

.header-title {
    background-color: #fff;
    color: var(--bg-color);
    padding: 5px 20px;
    border-radius: 20px;
    font-weight: bold;
}

.user-menu {
    font-size: 0.9em;
}
.user-name {
    font-weight: bold;
}

.main-content {
    display: flex;
    flex-grow: 1;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

.chat-and-input {
    flex: 3;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    border-radius: 20px;
    padding: 20px;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 70%;
}
.message.agent {
    align-self: flex-start;
}
.message.user {
    align-self: flex-end;
}

.message-content {
    padding: 15px;
    border-radius: 20px;
}

.message.agent .message-content {
    background-color: var(--agent-msg-bg);
    color: var(--text-color);
    border-top-left-radius: 0;
}

.message.user .message-content {
    background-color: var(--user-msg-bg);
    color: var(--light-text);
    border-top-right-radius: 0;
}

.message-meta {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 5px;
    text-align: right;
}

.chat-input-area {
    position: relative;
    margin-top: 20px;
    flex-shrink: 0;
}

#userInput {
    width: 100%;
    height: 60px;
    border-radius: 15px;
    border: 1px solid #ccc;
    padding: 10px 100px 10px 20px;
    box-sizing: border-box;
    font-size: 1em;
    resize: none;
}

.chat-control-button {
    position: absolute;
    bottom: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    color: white;
    font-size: 1.2em;
    display: flex;
    justify-content: center;
    align-items: center;
}
.send-button {
    right: 10px;
    background-color: var(--send-button-bg);
}
.mic-button {
    right: 60px;
    background-color: var(--mic-button-bg);
    color: #333;
}

.settings-button {
    background-color: transparent;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
}

.mic-button.recording {
    background-color: #e63946;
    color: white;
    animation: pulse 1.5s infinite;
}

.mic-button.processing {
    background-color: #fca311;
    color: white;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.gallery-panel {
    flex: 1;
    background-color: var(--gallery-bg);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.gallery-header {
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 20px;
}
.gallery-content {
    flex-grow: 1;
    background-color: white;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.gallery-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-item.active {
    opacity: 1;
    z-index: 1;
}

.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    position: relative;
    color: #333;
}

.modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h4 {
    margin-bottom: 0.5rem;
}

.modal-section ul {
    list-style: none;
    padding-left: 0;
}

.modal-section li {
    margin-bottom: 0.5rem;
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-button {
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
}

.action-button {
    background-color: var(--send-button-bg);
    color: white;
}

.secondary-button {
    background-color: #eee;
    color: #555;
    border: 1px solid #ccc;
}

.test-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.test-button {
    flex-grow: 1;
    margin-right: 1rem;
    background-color: #f0f0f0;
    color: #333;
    text-align: left;
}

.test-result {
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

.test-result.success { color: #28a745; }
.test-result.failure { color: #dc3545; }
.test-result.pending { color: #ffc107; }

/* --- Login Page Styles --- */
.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo-section {
    margin-bottom: 2rem;
}

.logo-section .logo {
    height: 80px; /* Aumentado desde 60px */
    width: auto;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.logo-section h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.logo-section .subtitle {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.company-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.company-text {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.company-logo {
    height: 40px; /* Aumentado desde 30px */
    width: auto;
    opacity: 0.8;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="email"]:focus,
input[type="password"]:focus {
    border-color: #667eea;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.login-btn:disabled, .loading {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}
.loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    color: #6c757d;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- Responsive Design for Mobile --- */
@media (max-width: 768px) {
    html, body {
        overflow: auto; /* Permitir scroll en móvil */
        height: auto;
    }

    .main-content {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }

    .chat-and-input {
        min-height: 60vh; /* Asegura que el chat tenga una altura mínima considerable */
        order: 1; /* Mantiene el chat primero */
    }

    .gallery-panel {
        min-height: 300px; /* Altura mínima para la galería */
        max-height: 50vh;  /* Evita que sea demasiado alta */
        order: 2; /* Mueve la galería debajo del chat */
    }

    .header-title {
        font-size: 0.9em;
        padding: 5px 15px;
    }

    #userInput {
        height: 50px;
        padding-right: 95px;
    }
    
    .chat-control-button {
        bottom: 5px;
        width: 38px;
        height: 38px;
    }

    .mic-button {
        right: 55px;
    }
    .send-button {
        right: 10px;
    }

    .message {
        max-width: 90%; /* Mensajes pueden ser un poco más anchos */
    }
}

/* Estilos para el botón de reporte */
.report-button-container {
    margin-top: 10px;
}

.report-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #4CAF50; /* Un verde distintivo */
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.report-button:hover {
    background-color: #45a049; /* Un verde un poco más oscuro */
}

/* =================================================================== */
/* ESTILOS PARA FORMULARIO DE CALENDARIO */
/* =================================================================== */

/* Modal de calendario más ancho */
.calendar-modal {
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Botón de agenda con estilo especial */
.agenda-button {
    background-color: #4CAF50 !important;
    color: white;
    border: none;
    font-weight: bold;
}

.agenda-button:hover {
    background-color: #45a049 !important;
}

.admin-button {
    background-color: #FF9800 !important;
    color: white;
    border: none;
    font-weight: bold;
}

.admin-button:hover {
    background-color: #F57C00 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.3);
}

/* Formulario de calendario */
.calendar-form {
    padding: 0;
}

.form-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 15px;
}

.form-section h4 {
    color: var(--header-bg);
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--header-bg);
    box-shadow: 0 0 5px rgba(106, 68, 181, 0.3);
}

.form-group input[required] {
    border-left: 4px solid #e74c3c;
}

.form-group input[required]:valid {
    border-left: 4px solid #27ae60;
}

/* Filas de formulario */
.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

.form-group.half {
    flex: 1;
}

/* Checkbox personalizado */
.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: var(--header-bg);
    border-color: var(--header-bg);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Acciones del formulario */
.form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Campos específicos */
input[type="date"],
input[type="time"] {
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

select {
    cursor: pointer;
}

/* Responsive para modales en móvil */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 10px;
        padding: 1.5rem;
    }
    
    .calendar-modal {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
    }
}

/* =================================================================== */
/* ESTILOS PARA BOTONES DE SELECCIÓN Y MODALES */
/* =================================================================== */

/* Contenedores con botones */
.input-with-button,
.textarea-with-button {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.input-with-button input,
.textarea-with-button textarea {
    flex: 1;
}

/* Botones de selección */
.select-button {
    background-color: #007bff !important;
    color: white !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background-color 0.3s !important;
    white-space: nowrap !important;
    min-width: 120px !important;
    box-sizing: border-box !important;
}

.select-button:hover {
    background-color: #0056b3 !important;
}

.select-button:active {
    background-color: #004494 !important;
}

/* Grupo de botones */
.button-group {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

.button-group .select-button {
    min-width: 100px !important;
}

/* Modales de selección */
.selector-modal {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
}

.selector-content {
    padding: 20px 0;
}

.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.search-box input:focus {
    outline: none;
    border-color: var(--header-bg);
    box-shadow: 0 0 5px rgba(106, 68, 181, 0.3);
}

.selector-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
}

.selector-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selector-item:hover {
    background-color: #f8f9fa;
}

.selector-item:last-child {
    border-bottom: none;
}

.selector-item.selected {
    background-color: var(--header-bg);
    color: white;
}

.selector-item-title {
    font-weight: 500;
    color: #333;
}

.selector-item.selected .selector-item-title {
    color: white;
}

.selector-item-subtitle {
    font-size: 12px;
    color: #666;
}

.selector-item.selected .selector-item-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

.selector-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

/* Responsive para modales de selección */
@media (max-width: 768px) {
    .input-with-button,
    .textarea-with-button {
        flex-direction: column;
        gap: 8px;
    }
    
    .select-button {
        min-width: auto !important;
    }
    
    .selector-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .selector-list {
        max-height: 300px;
    }
}

/* =================================================================== */
/* ESTILOS PARA EDICIÓN DE EVENTOS */
/* =================================================================== */

/* Header del calendario con acciones */
.calendar-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.header-action-button {
    background-color: #17a2b8 !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background-color 0.3s !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.header-action-button:hover {
    background-color: #138496 !important;
}

.header-action-button:active {
    background-color: #117a8b !important;
}

/* Modal de lista de eventos */
.events-list-modal {
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
}

.events-selector-content {
    padding: 20px 0;
}

.events-list-container {
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.events-list {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    max-height: 450px;
    overflow-y: auto;
}

.event-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-item:hover {
    background-color: #f8f9fa;
}

.event-item:last-child {
    border-bottom: none;
}

.event-item.selected {
    background-color: var(--header-bg);
    color: white;
}

.event-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.event-item-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
}

.event-item.selected .event-item-title {
    color: white;
}

.event-item-datetime {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    background-color: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
}

.event-item.selected .event-item-datetime {
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.2);
}

.event-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.event-item-location {
    font-size: 12px;
    color: #666;
    background-color: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.event-item.selected .event-item-location {
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(255, 255, 255, 0.15);
}

.event-item-participants {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.event-item.selected .event-item-participants {
    color: rgba(255, 255, 255, 0.7);
}

.events-list-info {
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    color: #666;
}

.events-selector-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.no-future-events {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
}

.no-future-events-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Responsive para modal de eventos */
@media (max-width: 768px) {
    .events-list-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .events-list-container {
        max-height: 350px;
    }
    
    .events-list {
        max-height: 350px;
    }
    
    .event-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .event-item-datetime {
        align-self: flex-end;
    }
    
    .calendar-header-actions {
        justify-content: center;
    }
}

/* === SISTEMA DE PROGRESO PARA ADMINISTRACIONES === */
.processing-administrations {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f4fd 100%);
    border-radius: 15px;
    border: 1px solid #d1e7ff;
    margin: 10px 0;
}

.spinner-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e3f2fd;
    border-top: 4px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

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

.processing-text {
    flex: 1;
}

.main-text {
    font-size: 16px;
    font-weight: 600;
    color: #1565c0;
    margin-bottom: 8px;
}

.sub-text {
    font-size: 14px;
    color: #757575;
    margin-bottom: 10px;
    line-height: 1.4;
}

.stages-text {
    font-size: 12px;
    color: #424242;
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .spinner-container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .spinner {
        align-self: center;
    }
    
    .main-text {
        font-size: 14px;
    }
    
    .sub-text {
        font-size: 13px;
    }
    
    .stages-text {
        font-size: 11px;
        padding: 6px 10px;
    }
}