/* ═══════════════════════════════════════════
   RYM COACH CHATBOT — Floating Bubble Styles
   New Wave Creative
   ═══════════════════════════════════════════ */

:root {
    --rym-primary:     #1a3a5c;
    --rym-accent:      #2e7d52;
    --rym-accent-lt:   #3a9d68;
    --rym-bg:          #ffffff;
    --rym-bg-chat:     #f4f6f9;
    --rym-bot-bubble:  #ffffff;
    --rym-user-bubble: #1a3a5c;
    --rym-text:        #1c2b3a;
    --rym-text-light:  #6b7a8d;
    --rym-border:      #dde3ec;
    --rym-shadow:      0 8px 40px rgba(26,58,92,0.18), 0 2px 8px rgba(0,0,0,0.08);
    --rym-radius:      18px;
    --rym-font:        'Georgia', 'Times New Roman', serif;
    --rym-font-ui:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --rym-w:           380px;
    --rym-h:           560px;
    --rym-z:           999999;
}

/* ── Root Container ── */
#rym-coach-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--rym-z);
    font-family: var(--rym-font-ui);
}

/* ── Trigger Button ── */
#rym-coach-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rym-primary) 0%, #2a5490 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26,58,92,0.35), 0 2px 6px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

#rym-coach-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(26,58,92,0.45);
}

#rym-coach-trigger:active {
    transform: scale(0.96);
}

#rym-coach-trigger .rym-icon-chat,
#rym-coach-trigger .rym-icon-close {
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

#rym-coach-trigger .rym-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
    color: #fff;
    font-size: 20px;
    font-style: normal;
}

#rym-coach-root.rym-open #rym-coach-trigger .rym-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}

#rym-coach-root.rym-open #rym-coach-trigger .rym-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Notification dot */
#rym-coach-trigger::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: #2e9e5e;
    border-radius: 50%;
    border: 2px solid #fff;
    transition: opacity 0.2s;
}

#rym-coach-root.rym-open #rym-coach-trigger::after {
    opacity: 0;
}

/* ── Chat Window ── */
#rym-coach-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: var(--rym-w);
    height: var(--rym-h);
    background: var(--rym-bg);
    border-radius: var(--rym-radius);
    box-shadow: var(--rym-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--rym-border);

    /* Hidden by default */
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34,1.4,0.64,1);
    transform-origin: bottom right;
}

#rym-coach-root.rym-open #rym-coach-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
#rym-coach-header {
    background: linear-gradient(135deg, var(--rym-primary) 0%, #234d7a 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.rym-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rym-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.25);
}

.rym-header-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.rym-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
}

.rym-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    letter-spacing: 0.01em;
}

.rym-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rym-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(74,222,128,0.7);
    animation: rym-pulse 2.5s infinite;
}

@keyframes rym-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.rym-status-text {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
}

.rym-reset-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--rym-font-ui);
    transition: background 0.15s;
    margin-left: 4px;
}

.rym-reset-btn:hover {
    background: rgba(255,255,255,0.22);
}

/* ── Messages Area ── */
#rym-coach-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    background: var(--rym-bg-chat);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#rym-coach-messages::-webkit-scrollbar {
    width: 4px;
}
#rym-coach-messages::-webkit-scrollbar-track {
    background: transparent;
}
#rym-coach-messages::-webkit-scrollbar-thumb {
    background: var(--rym-border);
    border-radius: 4px;
}

/* ── Message Bubbles ── */
.rym-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: rym-msg-in 0.25s ease;
}

@keyframes rym-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rym-message--bot {
    justify-content: flex-start;
}

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

.rym-bubble {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.rym-message--bot .rym-bubble {
    background: var(--rym-bot-bubble);
    color: var(--rym-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    border: 1px solid var(--rym-border);
}

.rym-message--bot .rym-bubble p {
    margin: 0 0 6px;
}
.rym-message--bot .rym-bubble p:last-child {
    margin-bottom: 0;
}

.rym-message--user .rym-bubble {
    background: var(--rym-user-bubble);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.rym-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}

.rym-typing span {
    width: 7px;
    height: 7px;
    background: var(--rym-text-light);
    border-radius: 50%;
    animation: rym-bounce 1.2s infinite;
}
.rym-typing span:nth-child(2) { animation-delay: 0.2s; }
.rym-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rym-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* ── Suggested Questions ── */
#rym-coach-suggestions {
    padding: 8px 12px 6px;
    background: var(--rym-bg-chat);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid var(--rym-border);
    flex-shrink: 0;
}

#rym-coach-suggestions.rym-hidden {
    display: none;
}

.rym-suggestion {
    background: #fff;
    border: 1px solid var(--rym-border);
    border-radius: 20px;
    padding: 5px 11px;
    font-size: 12px;
    color: var(--rym-primary);
    cursor: pointer;
    font-family: var(--rym-font-ui);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.4;
}

.rym-suggestion:hover {
    background: var(--rym-primary);
    border-color: var(--rym-primary);
    color: #fff;
}

/* ── Input Area ── */
#rym-coach-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: var(--rym-bg);
    border-top: 1px solid var(--rym-border);
    flex-shrink: 0;
}

#rym-coach-input {
    flex: 1;
    border: 1.5px solid var(--rym-border);
    border-radius: 12px;
    padding: 9px 13px;
    font-size: 13.5px;
    font-family: var(--rym-font-ui);
    color: var(--rym-text);
    resize: none;
    outline: none;
    max-height: 100px;
    line-height: 1.45;
    background: var(--rym-bg-chat);
    transition: border-color 0.2s;
}

#rym-coach-input:focus {
    border-color: var(--rym-primary);
    background: #fff;
}

#rym-coach-input::placeholder {
    color: var(--rym-text-light);
}

#rym-coach-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rym-accent) 0%, var(--rym-accent-lt) 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

#rym-coach-send:hover {
    transform: scale(1.08);
}

#rym-coach-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Footer ── */
#rym-coach-footer {
    padding: 7px 14px 9px;
    font-size: 10.5px;
    color: var(--rym-text-light);
    text-align: center;
    background: var(--rym-bg);
    border-top: 1px solid var(--rym-border);
    line-height: 1.4;
    flex-shrink: 0;
}

/* ── Error message ── */
.rym-error {
    font-size: 12px;
    color: #c0392b;
    font-style: italic;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    :root {
        --rym-w: calc(100vw - 20px);
        --rym-h: calc(100vh - 110px);
    }

    #rym-coach-root {
        bottom: 16px;
        right: 10px;
    }

    #rym-coach-window {
        right: 0;
        bottom: 72px;
    }
}
