:root {
    --primary-color: #0f5f4c;
    /* Turismo Social Green */
    --primary-hover: #0a4f3e;
    --background-color: #f4f4f4;
    --chat-bg-color: #ffffff;
    --user-msg-bg: #0f5f4c;
    --user-msg-text: #ffffff;
    --bot-msg-bg: #f2f4f8;
    --bot-msg-text: #333333;
    --border-color: #e0e0e0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
}

#main-content {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

body.in-widget {
    background: transparent;
    height: 100dvh;
    align-items: stretch;
}

body.in-widget #main-content {
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
}

/* HEADER */
#title-container {
    padding: 15px 20px;
    background: #03594c;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    position: relative;
    min-height: 64px;
    box-sizing: border-box;
}

#title-container img {
    display: none;
}

.header-actions {
    display: none;
    align-items: center;
    gap: 0;
    background: transparent;
    padding: 6px 0;
}

.header-actions.visible {
    display: flex;
}

#home-button {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

#home-button:hover {
    color: rgba(255, 255, 255, 0.8);
}

#close-button {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        color 0.3s,
        background-color 0.3s;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    z-index: 10;
}

#close-button:hover {
    color: #03594c;
    /* Same as header background */
    background-color: white;
}

/* CHAT AREA */
#chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: var(--chat-bg-color);
    scroll-behavior: smooth;
}

/* WELCOME BLOCK INSIDE CHAT */
.chat-welcome {
    padding: 8px 4px 4px;
}

.chat-welcome-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.chat-welcome-subtitle {
    font-size: 1rem;
    color: #555;
    margin: 0 0 12px 0;
}

.message {
    max-width: 80%;
    padding: 14px 20px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease;
}

.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--user-msg-bg), #1a7a63);
    color: var(--user-msg-text);
    border-bottom-right-radius: 4px;
}

.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(15, 95, 76, 0.1);
    color: var(--bot-msg-text);
    border-bottom-left-radius: 4px;
}

/* INPUT AREA */
#input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

#question-input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

#question-input:focus {
    border-color: var(--primary-color);
}

#send-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background-color 0.3s,
        transform 0.2s;
    font-size: 1.1rem;
}

#send-button:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

#clear-all-button {
    background: transparent;
    color: #999;
    border: none;
    cursor: pointer;
    padding: 10px;
    font-size: 1.1rem;
    transition: color 0.3s;
    display: none;
}

#clear-all-button:hover {
    color: var(--primary-color);
}

/* UTILS */
.fade-in {
    animation: fadeIn 0.4s ease forwards;
    opacity: 0;
}

.slide-in {
    animation: slideIn 0.4s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.message-content {
    display: block;
    width: 100%;
    overflow-x: auto;
}

/* MARKDOWN TABLES & CONTENT */
.message strong {
    color: inherit;
    font-weight: 700;
}

.bot strong {
    color: var(--primary-color);
}

.bot h3 {
    margin: 0 0 10px 0;
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color);
    font-size: 1.15rem;
    border-bottom: 1px solid rgba(15, 95, 76, 0.1);
    padding-bottom: 5px;
}

.message table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9em;
    margin: 15px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message th {
    background-color: #f8f9fa;
    color: var(--primary-color);
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.message td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    color: #444;
    max-width: 250px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.message tr:last-child td {
    border-bottom: none;
}

.message tr:nth-child(even) {
    background-color: #fafafa;
}

.message tr:hover {
    background-color: #f1f6f5;
}

/* Estilo para truncar contenido de celdas largas */
.message td .cell-wrapper {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    max-height: 4.5em;
    /* 3 lines * 1.5 */
}

.message tr.expanded td .cell-wrapper {
    display: block;
    max-height: none;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Indicador visual de que es clicable (solo puntos suspensivos) */
.message tr:not(.expanded) td .cell-wrapper::after {
    content: '...';
    color: var(--primary-color);
    font-size: 1.1em;
    display: block;
    font-weight: 700;
}

/* SCROLLBAR */
#chat-container::-webkit-scrollbar {
    width: 6px;
}

#chat-container::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

#chat-container::-webkit-scrollbar-track {
    background-color: transparent;
}

/* SUGGESTION CARDS */
.suggestions-grid {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 10px;
    margin-top: 0px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
}

.suggestion-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.suggestion-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.suggestion-row .suggestion-card.small {
    flex: 1;
    min-height: 92px;
}

/* Igualar alto de filas dentro de la misma columna de sugerencias */
.suggestion-column > .suggestion-row {
    align-items: stretch;
}

.suggestion-column > .suggestion-card.small {
    min-height: 92px;
}

.suggestion-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.suggestion-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.suggestion-card.big {
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    min-height: 194px;
    background: linear-gradient(to bottom right, #ffffff, #f9f9f9);
}

.suggestion-card.small {
    flex: 1;
    min-height: 92px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 12px;
}

.suggestion-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.suggestion-card.small .suggestion-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.suggestion-card.big .suggestion-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.suggestion-text {
    font-weight: normal;
    font-size: 1rem;
    color: #333;
    line-height: 1.2;
}

.suggestion-card.small .suggestion-text {
    font-size: 0.85rem;
    line-height: 1.25;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
}

.sub-suggestions-block {
    width: min(70%, 760px);
    max-width: 100%;
}

.sub-suggestions-block .suggestions-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 18px;
}

.sub-suggestions-block .suggestion-card.small {
    min-height: 52px;
    padding: 12px 18px;
}

.sub-suggestions-block .suggestion-card.small .suggestion-text {
    font-size: 0.95rem;
    line-height: 1.35;
}

@media (max-width: 640px) {
    .sub-suggestions-block {
        width: 100%;
    }
}

.badge-new {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #d7192d;
    /* Make this Red to stand out even in green theme, or use primary */
    color: white;
    padding: 5px 12px;
    border-bottom-right-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

/* TYPING INDICATOR */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {
    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.wave-icon {
    animation: wave 2s ease-in-out infinite;
    transform-origin: 70% 70%;
    display: inline-block;
}

@keyframes wave {
    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

#chat-disclaimer {
    font-size: 0.8rem;
    color: #6b6b6b;
    text-align: center;
    padding: 4px 20px 0;
    margin-bottom: 15px;
    background: white;
    opacity: 0.9;
}

.suggestions-intro {
    font-size: 1rem;
    color: #555;
    margin: 8px 4px 0px;
}
