/* =========================================================
   홀로알다 AI 위젯
   경로: /theme/eb4_comm_003/css/ai_widget.css
========================================================= */

:root {
    --holo-ai-red: #ef3b3b;
    --holo-ai-red-dark: #d92d2d;
    --holo-ai-orange: #ff8a1f;
    --holo-ai-orange-dark: #f06f00;
    --holo-ai-text: #222222;
    --holo-ai-muted: #777777;
    --holo-ai-border: #ececec;
    --holo-ai-bg: #ffffff;
    --holo-ai-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

/* 접근성용 숨김 */
.holo-ai-screen-reader-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 기본 리셋 */
.holo-ai-widget,
.holo-ai-widget * {
    box-sizing: border-box;
}

.holo-ai-widget button,
.holo-ai-widget textarea,
.holo-ai-widget input {
    font: inherit;
}

.holo-ai-widget button {
    cursor: pointer;
}

.holo-ai-widget img {
    display: block;
    max-width: 100%;
}

/* =========================================================
   플로팅 캐릭터 카드
========================================================= */

.holo-ai-floating-button {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 10005;

    width: 198px;
    height: 78px;
    padding: 8px 15px 8px 8px;

    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;

    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 22px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.99),
            rgba(255, 249, 245, 0.99)
        );

    color: var(--holo-ai-text);

    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.20),
        0 0 0 3px rgba(255, 138, 31, 0.08);

    overflow: visible;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.holo-ai-floating-button:hover {
    transform: translateY(-3px);

    border-color: rgba(255, 138, 31, 0.28);

    box-shadow:
        0 16px 38px rgba(0, 0, 0, 0.25),
        0 0 0 4px rgba(255, 138, 31, 0.12);
}

.holo-ai-floating-button:active {
    transform: scale(0.98);
}

/* 플로팅 이미지 롤링 영역 */
.holo-ai-floating-characters {
    position: relative;

    width: 60px;
    height: 60px;

    flex: 0 0 60px;
    display: block;

    border: 2px solid rgba(255, 138, 31, 0.24);
    border-radius: 18px;

    overflow: hidden;

    background: #f3f3f3;

    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.8),
        0 4px 12px rgba(0, 0, 0, 0.10);
}

/* 두 이미지를 같은 위치에 겹침 */
.holo-ai-floating-character {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;
    max-width: none;

    object-fit: cover;
    object-position: center 18%;

    opacity: 0;
    visibility: hidden;

    transform: scale(1.05);

    transition:
        opacity 0.55s ease,
        visibility 0.55s ease,
        transform 0.55s ease;
}

.holo-ai-floating-character.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.holo-ai-floating-icon {
    display: none;
}

.holo-ai-floating-text {
    position: relative;

    display: block;

    color: #242424;

    font-size: 13px;
    font-weight: 900;
    line-height: 1.28;
    letter-spacing: -0.55px;
    text-align: left;
    white-space: nowrap;
}

.holo-ai-floating-text::before {
    content: "오늘도 기다리고 있어";

    display: block;
    margin-bottom: 2px;

    color: #999999;

    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.holo-ai-notification-dot {
    position: absolute;
    top: -5px;
    right: -5px;

    width: 15px;
    height: 15px;

    border-radius: 50%;

    background: var(--holo-ai-red);
    border: 3px solid #ffffff;

    animation: holoAiPulse 1.7s infinite;
}

@keyframes holoAiPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 59, 59, 0.48);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 59, 59, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 59, 59, 0);
    }
}

/* =========================================================
   초대 말풍선
========================================================= */

.holo-ai-invite-bubble {
    position: fixed;
    left: 242px;
    bottom: 30px;
    z-index: 10006;

    width: 290px;
    min-height: 78px;
    padding: 17px 44px 17px 20px;

    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;

    background: rgba(255, 255, 255, 0.99);
    color: var(--holo-ai-text);

    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;

    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.20),
        0 0 0 1px rgba(255, 255, 255, 0.75);
}

.holo-ai-invite-bubble::before {
    content: "";

    position: absolute;
    left: -10px;
    bottom: 27px;

    width: 20px;
    height: 20px;

    background: #ffffff;

    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);

    transform: rotate(45deg);
}

.holo-ai-invite-bubble strong {
    font-size: 17px;
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -0.5px;
}

.holo-ai-invite-bubble span {
    font-size: 13px;
    line-height: 1.45;
    color: var(--holo-ai-muted);
}

.holo-ai-invite-close {
    position: absolute;
    top: 8px;
    right: 10px;

    width: 28px;
    height: 28px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;
    color: #999999;

    font-size: 22px;
    line-height: 1;
}

.holo-ai-invite-close:hover {
    background: #f4f4f4;
    color: #444444;
}

/* =========================================================
   오버레이
========================================================= */

.holo-ai-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: none;

    background: rgba(10, 12, 18, 0.58);
    backdrop-filter: blur(3px);
}

/* =========================================================
   공통 모달
========================================================= */

.holo-ai-character-modal,
.holo-ai-chat-panel {
    position: fixed;
    z-index: 10010;

    display: none;

    background: var(--holo-ai-bg);
    color: var(--holo-ai-text);

    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;

    box-shadow: var(--holo-ai-shadow);

    overflow: hidden;
}

.holo-ai-character-modal[aria-hidden="false"] {
    display: block;
}

.holo-ai-chat-panel[aria-hidden="false"] {
    display: flex;
}

/* =========================================================
   캐릭터 선택 모달
========================================================= */

.holo-ai-character-modal {
    left: 50%;
    top: 50%;

    width: min(760px, calc(100vw - 36px));
    max-height: calc(100vh - 40px);

    transform: translate(-50%, -50%);
    overflow-y: auto;
}

.holo-ai-modal-header {
    padding: 26px 28px 18px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    border-bottom: 1px solid var(--holo-ai-border);
}

.holo-ai-modal-header h2 {
    margin: 0 0 8px;

    font-size: 26px;
    line-height: 1.2;
}

.holo-ai-modal-header p {
    margin: 0;

    font-size: 14px;
    color: var(--holo-ai-muted);
}

.holo-ai-close-button {
    flex: 0 0 auto;

    width: 40px;
    height: 40px;

    border: 0;
    border-radius: 50%;

    background: #f5f5f5;
    color: #222222;

    font-size: 28px;
    line-height: 1;
}

.holo-ai-character-list {
    padding: 24px;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.holo-ai-character-card {
    position: relative;

    min-height: 430px;
    padding: 18px;

    display: flex;
    flex-direction: column;
    align-items: stretch;

    text-align: left;

    border-radius: 22px;
    background: #ffffff;

    overflow: hidden;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.holo-ai-character-card:hover {
    transform: translateY(-4px);
}

.holo-ai-character-euni {
    border: 2px solid rgba(239, 59, 59, 0.28);
    box-shadow: 0 12px 30px rgba(239, 59, 59, 0.10);
}

.holo-ai-character-euni:hover {
    border-color: var(--holo-ai-red);
    box-shadow: 0 16px 34px rgba(239, 59, 59, 0.18);
}

.holo-ai-character-yeni {
    border: 2px solid rgba(255, 138, 31, 0.30);
    box-shadow: 0 12px 30px rgba(255, 138, 31, 0.12);
}

.holo-ai-character-yeni:hover {
    border-color: var(--holo-ai-orange);
    box-shadow: 0 16px 34px rgba(255, 138, 31, 0.20);
}

.holo-ai-character-avatar {
    position: relative;

    width: 100%;
    height: 220px;
    margin-bottom: 18px;

    display: block;

    border-radius: 18px;
    overflow: hidden;

    background: #f5f5f5;
}

.holo-ai-character-image {
    width: 100%;
    height: 100%;
    max-width: none;

    object-fit: cover;
    object-position: center 18%;

    transition: transform 0.35s ease;
}

.holo-ai-character-card:hover .holo-ai-character-image {
    transform: scale(1.035);
}

.holo-ai-character-euni .holo-ai-character-avatar {
    background: linear-gradient(145deg, #fff0f0, #ffdcdc);
}

.holo-ai-character-yeni .holo-ai-character-avatar {
    background: linear-gradient(145deg, #fff5e9, #ffe3c7);
}

.holo-ai-avatar-placeholder {
    display: none;
}

.holo-ai-character-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.holo-ai-character-info strong {
    font-size: 24px;
    line-height: 1.1;
}

.holo-ai-heart {
    margin-left: 3px;
}

.holo-ai-heart-red {
    color: var(--holo-ai-red);
}

.holo-ai-heart-orange {
    color: var(--holo-ai-orange);
}

.holo-ai-character-info small {
    font-size: 14px;
    color: var(--holo-ai-muted);
}

.holo-ai-character-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.holo-ai-character-tags em {
    padding: 6px 9px;

    border-radius: 999px;

    font-style: normal;
    font-size: 12px;
    font-weight: 700;
}

.holo-ai-character-euni .holo-ai-character-tags em {
    color: var(--holo-ai-red-dark);
    background: #fff0f0;
}

.holo-ai-character-yeni .holo-ai-character-tags em {
    color: var(--holo-ai-orange-dark);
    background: #fff2e4;
}

.holo-ai-character-quote {
    margin-top: 4px;

    font-size: 14px;
    color: #555555;
}

.holo-ai-character-action {
    margin-top: auto;
    padding: 14px 16px;

    display: block;

    border-radius: 14px;

    color: #ffffff;

    text-align: center;
    font-size: 15px;
    font-weight: 800;
}

.holo-ai-character-euni .holo-ai-character-action {
    background: linear-gradient(
        135deg,
        var(--holo-ai-red),
        var(--holo-ai-red-dark)
    );
}

.holo-ai-character-yeni .holo-ai-character-action {
    background: linear-gradient(
        135deg,
        var(--holo-ai-orange),
        var(--holo-ai-orange-dark)
    );
}

.holo-ai-character-notice {
    margin: 0;
    padding: 0 24px 24px;

    color: var(--holo-ai-muted);

    text-align: center;
    font-size: 13px;
}

/* =========================================================
   채팅 패널
========================================================= */

.holo-ai-chat-panel {
    right: 24px;
    bottom: 24px;

    width: min(460px, calc(100vw - 32px));
    height: min(720px, calc(100vh - 48px));

    flex-direction: column;
}

.holo-ai-chat-header {
    flex: 0 0 auto;

    padding: 18px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    border-bottom: 1px solid var(--holo-ai-border);
    background: #ffffff;
}

.holo-ai-chat-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.holo-ai-chat-avatar {
    flex: 0 0 auto;

    width: 48px;
    height: 48px;

    display: block;

    border-radius: 50%;
    overflow: hidden;

    background: #f1f1f1;
    border: 2px solid #ffffff;

    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.holo-ai-chat-avatar img {
    width: 100%;
    height: 100%;
    max-width: none;

    object-fit: cover;
    object-position: center 18%;
}

.holo-ai-chat-profile h2 {
    margin: 0 0 4px;

    font-size: 21px;
}

.holo-ai-chat-profile p {
    margin: 0;

    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 12px;
    color: var(--holo-ai-muted);
}

.holo-ai-online-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;
    background: #21c55d;
}

.holo-ai-chat-header-actions {
    display: flex;
    gap: 6px;
}

.holo-ai-header-button {
    width: 38px;
    height: 38px;

    border: 0;
    border-radius: 50%;

    background: #f5f5f5;
    color: #333333;

    font-size: 22px;
    line-height: 1;
}

.holo-ai-message-list {
    flex: 1 1 auto;
    min-height: 0;

    padding: 20px;

    overflow-y: auto;
    background: #fafafa;
}

.holo-ai-message {
    margin-bottom: 16px;

    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.holo-ai-message-assistant {
    justify-content: flex-start;
}

.holo-ai-message-user {
    justify-content: flex-end;
}

.holo-ai-message-avatar {
    flex: 0 0 auto;

    width: 36px;
    height: 36px;

    display: block;

    border-radius: 50%;
    overflow: hidden;

    background: #f1f1f1;
    border: 2px solid #ffffff;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

.holo-ai-message-avatar img {
    width: 100%;
    height: 100%;
    max-width: none;

    object-fit: cover;
    object-position: center 18%;
}

.holo-ai-message-content {
    max-width: 78%;

    display: flex;
    flex-direction: column;
    gap: 5px;
}

.holo-ai-message-user .holo-ai-message-content {
    align-items: flex-end;
}

.holo-ai-message-bubble {
    padding: 13px 15px;

    border-radius: 18px;

    font-size: 14px;
    line-height: 1.55;

    word-break: keep-all;
    overflow-wrap: anywhere;
}

.holo-ai-message-assistant .holo-ai-message-bubble {
    border-bottom-left-radius: 5px;

    background: #ffffff;
    border: 1px solid #eeeeee;
}

.holo-ai-message-user .holo-ai-message-bubble {
    border-bottom-right-radius: 5px;
    background: #ffe2cb;
}

.holo-ai-message-time {
    font-size: 11px;
    color: #999999;
}

/* =========================================================
   체험 / 가입 유도
========================================================= */

.holo-ai-trial-box {
    flex: 0 0 auto;

    margin: 0 16px 12px;
    padding: 15px;

    border: 1px solid #ffd8b2;
    border-radius: 18px;

    background: #fff8ef;
}

.holo-ai-trial-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.holo-ai-trial-status strong {
    font-size: 14px;
}

.holo-ai-trial-status span {
    color: var(--holo-ai-orange-dark);

    font-size: 15px;
    font-weight: 900;
}

.holo-ai-trial-box p {
    margin: 10px 0 12px;

    color: #666666;

    font-size: 12px;
    line-height: 1.5;
}

.holo-ai-signup-button {
    width: 100%;
    padding: 13px 16px;

    display: block;

    border-radius: 14px;

    background: linear-gradient(
        135deg,
        var(--holo-ai-orange),
        var(--holo-ai-orange-dark)
    );

    color: #ffffff !important;

    text-align: center;
    text-decoration: none !important;

    font-size: 14px;
    font-weight: 900;
}

.holo-ai-login-link {
    margin-top: 10px;

    display: block;

    color: #777777 !important;

    text-align: center;
    text-decoration: underline;

    font-size: 12px;
}

/* =========================================================
   입력 폼
========================================================= */

.holo-ai-chat-form {
    flex: 0 0 auto;

    padding: 12px 14px 14px;

    border-top: 1px solid var(--holo-ai-border);
    background: #ffffff;
}

.holo-ai-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.holo-ai-voice-button,
.holo-ai-send-button {
    flex: 0 0 auto;

    width: 42px;
    height: 42px;

    border: 0;
    border-radius: 50%;
}

.holo-ai-voice-button {
    background: #f1f1f1;
    color: #aaaaaa;
}

.holo-ai-voice-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.holo-ai-send-button {
    background: linear-gradient(
        145deg,
        var(--holo-ai-orange),
        var(--holo-ai-orange-dark)
    );

    color: #ffffff;
    font-size: 18px;
}

.holo-ai-chat-form textarea {
    flex: 1 1 auto;

    min-height: 42px;
    max-height: 120px;

    padding: 11px 14px;

    resize: none;

    border: 1px solid #dddddd;
    border-radius: 18px;

    background: #fafafa;
    color: #222222;

    line-height: 1.45;
    outline: none;
}

.holo-ai-chat-form textarea:focus {
    border-color: var(--holo-ai-orange);
    box-shadow: 0 0 0 3px rgba(255, 138, 31, 0.12);
}

.holo-ai-input-notice {
    margin: 8px 0 0;

    color: #999999;

    text-align: center;
    font-size: 10px;
}

/* =========================================================
   모바일 반응형
========================================================= */

@media (max-width: 768px) {
    .holo-ai-floating-button {
        left: auto;
        right: 16px;
        bottom: 92px;

        width: 166px;
        height: 68px;

        padding: 6px 12px 6px 6px;
        gap: 9px;

        border-radius: 20px;

        z-index: 9998;
    }

    .holo-ai-floating-characters {
        width: 54px;
        height: 54px;

        flex-basis: 54px;
        border-radius: 16px;
    }

    .holo-ai-floating-text {
        font-size: 11px;
        line-height: 1.22;
        letter-spacing: -0.45px;
    }

    .holo-ai-floating-text::before {
        margin-bottom: 1px;

        font-size: 9px;
        letter-spacing: -0.25px;
    }

    .holo-ai-notification-dot {
        top: -5px;
        right: -5px;

        width: 14px;
        height: 14px;
    }

    .holo-ai-invite-bubble {
        left: auto;
        right: 16px;
        bottom: 172px;

        width: min(290px, calc(100vw - 32px));
        min-height: 78px;

        padding: 16px 42px 16px 18px;

        z-index: 10006;
    }

    .holo-ai-invite-bubble::before {
        left: auto;
        right: 36px;
        bottom: -10px;

        border-left: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        border-right: 1px solid rgba(0, 0, 0, 0.08);
    }

    .holo-ai-invite-bubble strong {
        font-size: 16px;
    }

    .holo-ai-invite-bubble span {
        font-size: 13px;
    }

    .holo-ai-character-modal {
        top: auto;
        bottom: 0;
        left: 0;

        width: 100%;
        max-height: 90vh;

        border-radius: 24px 24px 0 0;

        transform: none;
    }

    .holo-ai-modal-header {
        padding: 20px 18px 15px;
    }

    .holo-ai-modal-header h2 {
        font-size: 21px;
    }

    .holo-ai-character-list {
        padding: 16px;

        grid-template-columns: 1fr;
        gap: 14px;
    }

    .holo-ai-character-card {
        min-height: 0;
        padding: 14px;
    }

    .holo-ai-character-avatar {
        height: 210px;
        margin-bottom: 14px;
    }

    .holo-ai-character-info strong {
        font-size: 21px;
    }

    .holo-ai-chat-panel {
        inset: 0;

        width: 100%;
        height: 100%;

        border-radius: 0;
    }

    .holo-ai-chat-header {
        padding:
            calc(14px + env(safe-area-inset-top))
            16px
            14px;
    }

    .holo-ai-message-list {
        padding: 16px;
    }

    .holo-ai-chat-form {
        padding:
            10px
            12px
            calc(12px + env(safe-area-inset-bottom));
    }
}

/* 아주 작은 모바일 화면 */
@media (max-width: 390px) {
    .holo-ai-floating-button {
        right: 12px;

        width: 154px;
        height: 64px;
    }

    .holo-ai-floating-characters {
        width: 50px;
        height: 50px;

        flex-basis: 50px;
    }

    .holo-ai-floating-text {
        font-size: 10px;
    }

    .holo-ai-floating-text::before {
        font-size: 8px;
    }

    .holo-ai-invite-bubble {
        right: 12px;
        bottom: 168px;

        width: calc(100vw - 24px);
    }
}