/* General styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f3f0;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    display: flex;
    /* Ensure flex for overall centering or layout */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* For login and welcome to center */
    padding: 20px;
    box-sizing: border-box;
}

/* Background geometric pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, #e5e5e5 2px, transparent 2px),
        radial-gradient(circle at 80% 20%, #e5e5e5 1px, transparent 1px),
        linear-gradient(45deg, transparent 40%, #e8e8e8 40%, #e8e8e8 42%, transparent 42%),
        radial-gradient(circle at 60% 70%, #e5e5e5 2px, transparent 2px),
        radial-gradient(circle at 30% 80%, #e5e5e5 1px, transparent 1px);
    background-size: 80px 80px, 60px 60px, 100px 100px, 90px 90px, 70px 70px;
    opacity: 0.3;
    pointer-events: none;
    z-index: -1;
}

/* Common container for forms/main sections */
.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    /* Default for login, adjust in specific pages if needed */
    text-align: center;
    margin: auto;
    /* Centrar horizontalmente si el body no tiene flex total */
}

/* Form common styles (login, upload, welcome container) */
.form-title,
.upload-title,
.welcome-title,
.page-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 30px;
}

/* Input group styles */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-label {
    display: block;
    color: #333;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: white;
}

.input-field:focus {
    outline: none;
    border-color: #87ceeb;
}

/* Common button styles */
.app-btn {
    width: 100%;
    padding: 14px;
    background: #87ceeb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.app-btn:hover {
    background: #6bb8db;
}

.app-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Link styles (reset, back, logout) */
.reset-link,
.back-link,
.logout-link {
    color: #87ceeb;
    text-decoration: none;
    font-size: 14px;
    margin-top: 20px;
    display: inline-block;
}

.reset-link:hover,
.back-link:hover,
.logout-link:hover {
    text-decoration: underline;
}

/* Specific error message style */
.error-message {
    color: red;
    background-color: #ffe0e0;
    border: 1px solid red;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    display: none;
    /* Hidden by default */
    text-align: center;
    font-size: 0.9em;
}

/* Styles for Upload Data Page */
.upload-container {
    max-width: 600px;
    /* Wider for upload interface */
    margin: auto;
}

.drop-area {
    border: 2px dashed #a0c4ff;
    border-radius: 15px;
    padding: 50px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    background-color: #e0f2f7;
}

.drop-area:hover {
    border-color: #5b9bd5;
    background-color: #d1e8ed;
}

.drop-area.highlight {
    border-color: #2c5aa0;
    box-shadow: 0 0 15px rgba(44, 90, 160, 0.3);
}

.drop-icon {
    font-size: 60px;
    color: #2c5aa0;
    margin-bottom: 15px;
    display: block;
}

.drop-text {
    font-size: 18px;
    color: #555;
    margin-bottom: 10px;
}

.drop-subtext {
    font-size: 14px;
    color: #888;
}

.file-input {
    display: none;
}

#fileList {
    text-align: left;
    margin-bottom: 20px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 8px;
    background-color: #fcfcfc;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    color: #444;
    font-size: 14px;
}

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

.file-item .file-name {
    flex-grow: 1;
    margin-right: 10px;
    word-break: break-all;
}

.file-item .remove-file {
    color: #ff6b6b;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
}

.file-item .remove-file:hover {
    color: #ff3b3b;
}

/* Upload button */
.upload-btn {
    background-color: #2c5aa0;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: auto;
    min-width: 200px;
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.upload-btn:hover {
    background-color: #3a6ba8;
    transform: translateY(-2px);
}

/* Progress bar */
.progress-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 25px;
    overflow: hidden;
    height: 20px;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #87ceeb;
    border-radius: 5px;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    line-height: 20px;
    transition: width 0.3s ease;
}

/* Hacemos esta regla más específica para que no afecte al chat */
.upload-container .message {
    margin-top: 20px;
    font-size: 15px;
    min-height: 20px;
    text-align: center;
}


/* Spinner for buttons */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 0.8s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Welcome Page Specific Styles */
.welcome-container {
    max-width: 500px;
    /* Adjust max-width for welcome page */
    margin: auto;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
    text-align: left;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-consultar {
    background: #87ceeb;
}

.btn-reportes {
    background: #90ee90;
}

.btn-crear {
    background: #dda0dd;
}

.btn-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}

.recent-projects {
    text-align: left;
}

.recent-title {
    color: #2c5aa0;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.project-item {
    color: #2c5aa0;
    font-size: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: color 0.3s;
}

.project-item:hover {
    color: #87ceeb;
}

/* Processing Data Page Specific Styles */
.main-container {
    /* Reusing .container but with different max-width */
    max-width: 900px;
    /* Wider for preview and chatbot */
    margin-top: 30px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.page-title {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.preview-section,
.chatbot-section,
.etl-section,
.transformed-data-preview {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    background-color: #f9f9f9;
    text-align: left;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.preview-title,
.chatbot-title,
.etl-title {
    font-size: 24px;
    color: #2c5aa0;
    margin-bottom: 15px;
}

/* Excel table styles from Pandas */
.dataframe {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}

.dataframe th,
.dataframe td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
}

.dataframe th {
    background-color: #e0f2f7;
    color: #333;
    font-weight: bold;
}

.dataframe tr:nth-child(even) {
    background-color: #f6f6f6;
}

/* PDF iframe styles */
.pdf-viewer {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 8px;
}

/* Audio player styles */
.audio-player {
    width: 100%;
    margin-top: 15px;
}

/* Chatbot specific styles */
.chat-window {
    height: 300px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: white;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message {
    background-color: #e0f7fa;
    align-self: flex-end;
    text-align: right;
}

.bot-message {
    background-color: #f0f0f0;
    align-self: flex-start;
    text-align: left;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.chat-input-area input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 16px;
}

.chat-input-area button {
    background-color: #2c5aa0;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.chat-input-area button:hover {
    background-color: #3a6ba8;
}

/* Typing indicator */
.typing-indicator {
    display: inline-block;
    margin-left: 5px;
    padding: 8px 12px;
    background-color: #f0f0f0;
    border-radius: 15px;
    align-self: flex-start;
    font-style: italic;
    color: #777;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #777;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }
}

/* ETL Section */
.etl-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.etl-input-area {
    display: flex;
    gap: 10px;
}

.etl-input-area textarea {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 16px;
    min-height: 80px;
    resize: vertical;
}

.etl-input-area button {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.etl-input-area button:hover {
    background-color: #0056b3;
}

.transformation-message-container {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    background-color: #e9f7ef;
    border: 1px solid #d4edda;
    color: #155724;
    font-weight: bold;
    text-align: center;
    display: none;
}

.transformation-message-container.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.transformed-data-preview {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background-color: #f9f9f9;
    text-align: left;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.transformed-data-preview h3 {
    font-size: 20px;
    color: #2c5aa0;
    margin-bottom: 15px;
}

.download-btn {
    /* Specific style for download button */
    margin-top: 20px;
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.download-btn:hover {
    background-color: #218838;
}

/* Responsive adjustments */
@media (max-width: 480px) {

    .container,
    .upload-container,
    .welcome-container {
        padding: 30px 20px;
        margin: 10px;
    }

    .form-title,
    .upload-title,
    .welcome-title,
    .page-title {
        font-size: 24px;
    }

    .drop-area {
        padding: 40px 15px;
    }

    .drop-icon {
        font-size: 50px;
    }

    .drop-text {
        font-size: 16px;
    }

    .upload-btn {
        padding: 12px 25px;
        font-size: 16px;
        min-width: 160px;
    }

    .action-btn {
        padding: 16px;
    }
}