/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: #0a0f1e;
    min-height: 100vh;
    justify-content: center;
    align-items: center;
}

/* Contenedor principal */
.chat-container {
    width: 100%;
    height: 100vh;
    background: #0a0f1e;
    overflow: hidden;
    display: flex;
    position: relative;
    padding-top: 85px;
}
.teletica{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #061a31;
    padding: 20px;
    z-index: 2000;
}
#teletica-logo{
    width: 150px;
}
#powered{
    width: 150px;
    float: right;
}
.hamburger {
    display: none;
    position: absolute;
    top: 18px;
    left: 15px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    position: absolute;
    left: 10px;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) { top: 14px; }
.hamburger span:nth-child(2) { top: 21px; }
.hamburger span:nth-child(3) { top: 28px; }
.hamburger.open span:nth-child(1) {
    transform: rotate(45deg);
    top: 21px;
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg);
    top: 21px;
}
/* Panel lateral izquierdo (FAQs e Historial) */
.sidebar {
    width: 420px;
    background: #0f1523;
    color: white;
    overflow-y: auto;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.sidebar-content {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.logo h1 {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.3;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a0a7ff;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(160, 167, 255, 0.3);
}

.faq-section {
    margin-bottom: 30px;
    padding-bottom: 5px;
}

.faq-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: white;
}

.faq-list {
    list-style: none;
}

.faq-item {
    background: #133741;
    border: 1px solid #1a797c;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.faq-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.faq-item:active {
    transform: translateX(5px) scale(0.98);
}

.faq-text {
    font-size: 15px;
    line-height: 1.5;
    color: white;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.history-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-name {
    font-size: 14px;
    font-weight: 500;
    color: white;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.new-chat-btn {
    width: 100%;
    padding: 14px;
    background: #1b9a96;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.new-chat-btn:hover {
    background: #0e7370;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.new-chat-btn:active {
    transform: translateY(0);
}
.question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.question-card {
    background: linear-gradient(180deg, #1f2937, #111827);
    border: 1px solid #374151;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all .25s ease;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.question-card:hover {
    transform: translateY(-4px);
    border-color: #60a5fa;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

.question-icon {
    font-size: 22px;
    margin-top: 2px;
}

.question-text {
    font-size: 14px;
    line-height: 1.4;
    color: #e5e7eb;
}

/* Área principal de chat */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0f1e;
    position: relative;
}

.chat-header {
    padding: 30px 40px;
    border-bottom: 1px solid #e0e5ff;
    background: white;
}

.chat-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1a2b6d;
    margin-bottom: 8px;
}

.chat-header p {
    font-size: 16px;
    color: #666;
}

.messages-container {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    background: #0a0f1e;
}

/* Mensajes */
.message {
    max-width: 70%;
    margin-bottom: 24px;
    margin-top: 24px;
    animation: fadeIn 0.3s ease;
}

.message.user {
    margin-left: auto;
}

.message.bot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}

.message-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.message-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    float: right;
}
.message-content {
    background-color: #f1f3f5;
    padding: 10px 14px;
    border-radius: 15px;
    max-width: 92%;
    word-wrap: break-word;
    text-align: justify;
}
.message-content {
    padding: 18px 24px;
    border-radius: 18px;
    line-height: 1.5;
    position: relative;
}

.message.user .message-content {
    background: #1a2332;
    color: white;
    border-top-right-radius: 0px;
    border: 1px solid #1b3a46;
}

.message.bot .message-content {
    background: #1a2332;
    color: #fff;
    border: 1px solid #1b3a46;
    border-top-left-radius: 0px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.message.bot .message-content img {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 15px;
}

/* Área de entrada */
.input-container {
    padding: 30px 40px;
    background: #1a2332;
    border-top: 1px solid #0e2935;
    position: relative;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 20px 70px 20px 25px;
    border: 2px solid #0e2935;
    border-radius: 16px;
    font-size: 16px;
    color: #fff;
    background: #1a2836;
    transition: all 0.3s ease;
}
.input-wrapper input:focus {
    outline: none;
    border-color: #22bcb8;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.15);
}

.input-wrapper input::placeholder {
    color: #999;
}

.send-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #4CAF50, #2196F3);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
}

.send-button:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.send-button:active {
    transform: translateY(-50%) scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(-50%);
}

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    gap: 6px;
    padding: 15px 20px;
    background: #1a2332;
    border-radius: 18px;
    border: 1px solid #e0e5ff;
    margin-bottom: 24px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #777b83;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-8px); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilos para markdown */
.message.bot .message-content h1,
.message.bot .message-content h2,
.message.bot .message-content h3 {
    color: #fff;
    margin-top: 0;
    margin-bottom: 10px;
}

.message.bot .message-content p {
    margin-bottom: 10px;
}

.message.bot .message-content ul,
.message.bot .message-content ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

.message.bot .message-content li {
    margin-bottom: 5px;
}



/* Separador */
.separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 30px 0;
    color: #999;
    font-size: 14px;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e5ff;
}

.separator span {
    padding: 0 15px;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1200px) {
    .chat-container {
        max-width: 95vw;
    }

    .sidebar {
        width: 350px;
    }
}

@media (max-width: 992px) {
    .chat-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
    }

    .sidebar-content {
        margin-top: 80px;
        padding: 20px;
    }

    .chat-area {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .chat-container {
        max-width: 100vw;
        height: var(--app-height);
        overflow: hidden;
    }

    .chat-area {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .messages-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 20px;
        padding-bottom: var(--input-height, 120px);
        padding-top: 80px;
    }

    .input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
    }

    .chat-header,
    .input-container {
        padding: 10px;
    }

    .message {
        max-width: 91%;
    }
}
@media (max-width: 500px) {
    .message-avatar img {
        width: 30px;
        height: 30px;
    }
    .message-user img {
        width: 30px;
        height: 30px;
    }
    .message-content {
        max-width: 89%;
    }
}

/* Scrollbar personalizada */
.messages-container::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #1b9a96;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}
.history-item.active {
    background-color: #2563eb; /* azul oscuro */
    color: white;
    border-radius: 8px;
}

.delete-chat-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s ease;
    z-index: 2;
}

.delete-chat-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Para que el contenido no se solape con el botón de eliminar */
.history-info {
    flex: 1;
    min-width: 0;
    padding-right: 40px; /* Espacio para el botón de eliminar */
}
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 85%;
        max-width: 380px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1002;
        max-height: 100vh;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1000;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }
    #teletica-logo {
        width: 132px;
        margin-left: 56px;
    }
    #powered {
        width: 100px;
        float: right;
    }
}
