/* =========================================================
   🎨 GLOBAL STYLES
========================================================= */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    background: transparent;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
}

#bs-chat-root {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   🪟 MAIN CONTAINER (Adjusted for Iframe)
========================================================= */
#card {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fffbff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    isolation: isolate;
}

#card,
#card * {
    box-sizing: border-box;
}

/* =========================================================
   🧭 TOP BAR
========================================================= */
.topBar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #2b2b2b, #0d0d0d);
    color: #fff;
    flex-shrink: 0;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #d72009;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    width: 24px;
    height: 24px;
}

.topTitle {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.topActions {
    display: flex;
    gap: 8px;
}

.topIconBtn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.topIconBtn:hover {
    transform: scale(1.1);
}

.bs-icon-white {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* =========================================================
   👋 ONBOARDING
========================================================= */
#onboarding {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
}

#onboarding.hidden {
    display: none !important;
}

.greetBox {
    padding: 20px 20px 10px;
}

.greetHi {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 4px;
}

.greetSub {
    font-size: 14px;
    color: #6b6b6b;
}

/* =========================================================
   ▶️ ACTIONS
========================================================= */
.actionRow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 20px;
}

.startBtn {
    flex: 1;
    border-radius: 999px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    background: #0f0f0f;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

/* HOVER START BTN (UNIQUE & RED) */
.startBtn:hover {
    background-color: #d72009 !important;
    color: #fff !important;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(215, 32, 9, 0.3);
}

.attachBtns {
    display: flex;
    gap: 10px;
}

.attachBtns button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.attachBtns button:hover {
    transform: scale(1.1);
}

.bs-icon-svg {
    width: 24px;
    height: 24px;
    opacity: 0.7;
}

/* =========================================================
   🧩 CARDS (Narrower & Taller)
========================================================= */
.cardsBox {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    /* Padding lateral aumentado para reducir ancho visual (~20%) */
    padding: 2px 35px;
    padding-bottom: 20px;
    overflow-y: auto;
    max-height: 100%;
}

.cardsBox::-webkit-scrollbar {
    width: 4px;
}

.cardsBox::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.card {
    border-radius: 12px;
    padding: 12px 8px;
    /* Padding vertical restaurado */
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    min-height: 90px;
    /* Más ALTAS */
}

/* Efectos Hover Card */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    filter: brightness(0.98);
}

.card:active {
    transform: scale(0.98);
}

.cardHeader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
    width: 100%;
}

.cardTitle {
    font-weight: 700;
    font-size: 0.8rem;
    color: #333;
}

.cardEmoji {
    font-size: 1.0rem;
}

.cardSub {
    font-size: 0.7rem;
    color: #666;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CARD COLORS */
.publishing {
    background-color: #fdf2f2;
}

.stages {
    background-color: #e9f5f5;
}

.submission {
    background-color: #fef7e9;
}

.editing {
    background-color: #f2f8fd;
}

.design {
    background-color: #fcf2fd;
}

.duration {
    background-color: #e8effd;
}

.formats {
    background-color: #fdf2f8;
}

.isbn {
    background-color: #fef7e9;
}

.pricing {
    background-color: #e9f7ff;
}

.rights {
    background-color: #fff3f7;
}

.availability {
    background-color: #f3ffe9;
}

.royalties {
    background-color: #f4f0ff;
}

/* =========================================================
   ✨ ANIMATIONS (Helper Classes)
========================================================= */
.bs-fade-out {
    opacity: 0 !important;
    transform: translateY(10px);
    pointer-events: none;
}

.bs-fade-in {
    opacity: 1 !important;
    transform: translateY(0);
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   BOTONES & TOOLTIPS (ESTILO ROJO)
========================================================= */
/* Tooltip Bubble (Red) */
[aria-label] {
    position: relative;
}

[aria-label]:hover::after {
    content: attr(aria-label);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);

    background: #d72009;
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 100001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 500;

    animation: fadeInTooltip 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

[aria-label]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #d72009 transparent transparent transparent;
    opacity: 0;
    z-index: 100001;

    animation: fadeInTooltip 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(0px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-6px);
    }
}

/* =========================================================
   💬 CHAT VIEW
========================================================= */
#chatView {
    display: none;
    flex: 1;
    flex-direction: column;
    height: 100%;
    transition: opacity 0.3s ease;
}

#chatView.active {
    display: flex;
}

.chatBody {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fffbff;
}

/* BUBBLES */
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-msg {
    align-self: flex-end;
    background: #000;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot-msg {
    align-self: flex-start;
    background: #f1f1f1;
    color: #000;
    border-bottom-left-radius: 4px;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 4px;
}

.msgRow {
    display: flex;
    align-items: flex-end;
    margin-bottom: 8px;
}

.msgRow.user {
    justify-content: flex-end;
}

.msgRow.bot {
    justify-content: flex-start;
}

.userBubble {
    background: #000;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 14px;
    max-width: 80%;
}

.botBubble {
    background: #f1f1f1;
    color: #000;
    border-radius: 18px 18px 18px 4px;
    padding: 10px 14px;
    max-width: 80%;
}

/* =========================================================
   📝 FOOTER
========================================================= */
.chatFooter {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.inputArea {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f8f8;
    border-radius: 20px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    outline: none;
    padding: 4px 0;
}

.micBtn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px;
    transition: transform 0.2s ease, background-color 0.2s;
}

.micBtn:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
}

.micBtn img {
    width: 20px;
    height: 20px;
}

.micBtn.recording {
    background-color: #ffdddd;
    border-radius: 50%;
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

.footerActions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leftActions {
    display: flex;
    gap: 12px;
}

.iconBtn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.iconBtn:hover {
    transform: scale(1.1);
}

.iconBtn img {
    width: 22px;
    height: 22px;
    opacity: 0.6;
}

.sendBtn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.sendBtn:hover {
    transform: scale(1.1);
}

.sendBtn img {
    width: 28px;
    height: 28px;
}