/* Custom styling for the chatbot application */

/* Chat interface styling */
.chat-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    background-color: white;
    scroll-behavior: smooth;
    /* Propiedades para scroll en dispositivos móviles */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.user-message .message-content {
    align-self: flex-end;
    background-color: #4A9EFF;
    color: white;
    border-radius: 15px 15px 0 15px;
    padding: 10px 15px;
    max-width: 80%;
    margin-left: auto;
}

.assistant-message .message-content {
    align-self: flex-start;
    background-color: var(--bs-secondary-bg);
    border-radius: 15px 15px 15px 0;
    padding: 10px 15px;
    max-width: 80%;
}

.message-timestamp {
    display: none;
}

/* Card hover effects */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2) !important;
}

/* Code and pre formatting */
pre {
    background-color: var(--bs-tertiary-bg);
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

code {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-danger);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
}

/* Form focus styles */
.form-control:focus, .btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Hero section image styling */
.hero-image {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Object fit for card images */
.object-fit-cover {
    object-fit: cover;
}

/* Space between sections */
section {
    margin-bottom: 3rem;
}

/* System message styling */
.system-message {
    width: 100%;
    text-align: center;
}

/* File input styling */
.form-control[type="file"] {
    padding: 0.375rem 0.75rem;
}

/* Add some padding to the page bottom */
body {
    padding-bottom: 2rem;
}

/* Layout de pantalla dividida con altura fija */
.split-screen-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    gap: 10px;
    height: calc(100vh - 120px) !important;
    min-height: 500px;
    max-height: calc(100vh - 100px);
    align-items: stretch !important;
    overflow: hidden;
}

.chat-section {
    flex: 1 1 50% !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    max-height: 100%;
    overflow: hidden;
    transition: flex 0.3s ease;
    align-self: flex-start !important;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background: white;
}

.chat-section .input-group {
    flex: 0 0 auto;
    margin-top: 0.5rem;
}

.chat-section.with-pdf {
    flex: 1 1 50% !important;
    max-width: 50% !important;
}

.pdf-section {
    flex: 1 1 50% !important;
    max-width: 50% !important;
    display: none;
    flex-direction: column;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    background: white;
    min-width: 0;
    align-self: flex-start !important;
}

.pdf-section.active {
    display: flex !important;
}

.chat-section, .pdf-section {
    height: 100% !important;
}

/* Estado maximizado del PDF */
.pdf-section.maximized {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 100% !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0 !important;
}

.pdf-section.maximized .pdf-viewer {
    height: calc(100vh - 60px) !important;
    flex: 1 1 auto !important;
}

.pdf-section.maximized .pdf-viewer object,
.pdf-section.maximized .pdf-viewer embed {
    height: 100% !important;
    min-height: 100% !important;
}

.pdf-section.maximized .pdf-header {
    flex: 0 0 auto !important;
    height: 60px !important;
}

.chat-section.pdf-maximized {
    display: none !important;
}

/* Responsive: En móviles, apilar verticalmente */
@media (max-width: 768px) {
    .split-screen-container {
        flex-direction: column;
        height: auto !important;
        min-height: 600px;
    }
    
    .chat-section.with-pdf {
        flex: 0 0 50%;
    }
    
    .pdf-section {
        flex: 0 0 50%;
    }
    
    /* Ajustes específicos del chat para móviles */
    .chat-container {
        max-height: calc(100vh - 200px);
        min-height: 300px;
    }
}
