:root {
    --bg-color: #0d1117;
    --panel-bg: #161b22;
    --accent-gold: #c5a880;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --lizia-blue: #00d2ff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

/* --- LOGIN --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}

.login-box {
    background: var(--panel-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border-top: 3px solid var(--accent-gold);
}

.login-box img {
    width: 150px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(197, 168, 128, 0.3);
}

.login-box h2 {
    margin-bottom: 20px;
    color: #fff;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #010409;
    color: #fff;
    outline: none;
    transition: border 0.3s;
}

.login-box input:focus {
    border-color: var(--accent-gold);
}

.login-box button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    background: var(--accent-gold);
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.login-box button:hover {
    background: #b09570;
}

/* --- CHAT --- */
.chat-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

.sidebar {
    width: 260px;
    background: var(--panel-bg);
    padding: 20px;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
}

.sidebar h3 {
    color: var(--accent-gold);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar img {
    width: 40px;
    border-radius: 5px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-history {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    min-height: 0;
}

.message {
    display: flex;
    gap: 15px;
    max-width: 80%;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.lizia {
    align-self: flex-start;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.lizia .avatar {
    border-color: var(--lizia-blue);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.user .avatar {
    border-color: var(--text-muted);
    background: #30363d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.bubble {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--panel-bg);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user .bubble {
    background: #238636;
    color: #fff;
}

.input-area {
    padding: 20px;
    background: var(--bg-color);
    border-top: 1px solid #30363d;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.input-box {
    display: flex;
    width: 100%;
    max-width: 800px;
    background: var(--panel-bg);
    border-radius: 24px;
    padding: 5px 15px;
    align-items: center;
    border: 1px solid #30363d;
}

.input-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px;
    outline: none;
    font-size: 16px;
    min-width: 0;
}

.input-box button {
    background: var(--accent-gold);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Animación de escritura */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px;
    align-items: center;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Botón de Logout */
.logout-button {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.logout-button:hover {
    background: #ff6b6b;
    color: #fff;
}

/* --- RESPONSIVE MÓVIL --- */
@media (max-width: 768px) {
    .login-box {
        padding: 28px 20px;
    }

    body {
        overflow: hidden;
    }

    .chat-wrapper {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        min-height: 64px;
        padding: 12px 14px;
        border-right: none;
        border-bottom: 1px solid #30363d;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .sidebar-top {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        flex: 1;
    }

    .sidebar h3 {
        margin-bottom: 0;
        font-size: 18px;
        white-space: nowrap;
    }

    .sidebar h3 img {
        width: 34px;
        height: 34px;
        object-fit: cover;
    }

    .sidebar-top p {
        display: none;
    }

    .sidebar-footer {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .logout-button {
        width: auto;
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .chat-main {
        flex: 1;
        min-height: 0;
    }

    .chat-history {
        padding: 14px;
        gap: 14px;
    }

    .message {
        max-width: 100%;
        gap: 10px;
    }

    .avatar {
        width: 34px;
        height: 34px;
    }

    .bubble {
        padding: 12px 14px;
        font-size: 15px;
        line-height: 1.45;
        border-radius: 14px;
        max-width: calc(100vw - 80px);
    }

    .input-area {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .input-box {
        max-width: 100%;
        padding: 4px 10px;
        border-radius: 18px;
    }

    .input-box input {
        font-size: 16px;
        padding: 10px;
    }

    .input-box button {
        width: 42px;
        height: 42px;
    }
}