/**
 * Sami Chatbot — MySongOriginal Design System
 * Forest #3d5a3d | Sage #7d9a78 | Terracotta #c67b5c | Cream #faf8f5 | Sand #e8e2d9
 * Fonts: Cormorant Garamond (display) + Outfit (body)
 */

:root {
    --sami-forest: #3d5a3d;
    --sami-sage: #7d9a78;
    --sami-terracotta: #c67b5c;
    --sami-cream: #faf8f5;
    --sami-sand: #e8e2d9;
    --sami-dark: #2a3d2a;
    --sami-light-sage: #a8c4a2;
    --sami-white: #ffffff;
    --sami-text: #2d2d2d;
    --sami-text-light: #6b6b6b;
    --sami-shadow: 0 8px 32px rgba(61, 90, 61, 0.15);
    --sami-shadow-light: 0 2px 12px rgba(61, 90, 61, 0.08);
    --sami-radius: 12px;
    --sami-radius-sm: 8px;
}

/* ═══ DASHBOARD TILE ═══ */

.sami-dashboard-tile {
    background: var(--sami-cream);
    border: 1px solid var(--sami-sand);
    border-radius: var(--sami-radius);
    padding: 20px;
    margin: 15px 0;
    transition: box-shadow 0.3s ease;
}

.sami-dashboard-tile:hover {
    box-shadow: var(--sami-shadow-light);
}

.sami-tile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sami-tile-title {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--sami-forest);
    margin: 0;
}

.sami-tile-status {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    color: var(--sami-sage);
    display: flex;
    align-items: center;
    gap: 5px;
}

.sami-status-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    animation: sami-pulse 2s infinite;
}

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

.sami-tile-desc {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--sami-text);
    margin-bottom: 15px;
    line-height: 1.5;
}

.sami-tile-btn {
    background: var(--sami-forest);
    color: var(--sami-cream);
    border: none;
    border-radius: var(--sami-radius-sm);
    padding: 10px 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.sami-tile-btn:hover {
    background: var(--sami-dark);
    transform: translateY(-1px);
    box-shadow: var(--sami-shadow-light);
}

/* ═══ CHATBOT MODAL ═══ */

.sami-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    animation: sami-slide-up 0.3s ease;
}

@keyframes sami-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sami-modal-content {
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 100px);
    background: var(--sami-white);
    border-radius: 16px;
    box-shadow: var(--sami-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--sami-sand);
}

.sami-chat-header {
    background: var(--sami-forest);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

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

.sami-chat-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--sami-cream);
    display: block;
    line-height: 1.2;
}

.sami-chat-role {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    color: var(--sami-light-sage);
    display: block;
}

.sami-close-btn {
    background: none;
    border: none;
    color: var(--sami-cream);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sami-close-btn:hover {
    opacity: 1;
}

/* Messages area */
.sami-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--sami-cream);
}

.sami-messages::-webkit-scrollbar {
    width: 4px;
}

.sami-messages::-webkit-scrollbar-thumb {
    background: var(--sami-sand);
    border-radius: 4px;
}

.sami-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    animation: sami-msg-in 0.2s ease;
}

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

.sami-msg-assistant {
    background: var(--sami-white);
    color: var(--sami-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--sami-sand);
}

.sami-msg-user {
    background: var(--sami-forest);
    color: var(--sami-cream);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.sami-typing {
    display: flex;
    gap: 4px;
    padding: 8px 14px;
    align-self: flex-start;
}

.sami-typing span {
    width: 7px;
    height: 7px;
    background: var(--sami-sage);
    border-radius: 50%;
    animation: sami-bounce 1.4s infinite;
}

.sami-typing span:nth-child(2) { animation-delay: 0.2s; }
.sami-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sami-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input area */
.sami-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--sami-sand);
    background: var(--sami-white);
    flex-shrink: 0;
}

.sami-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sami-input {
    flex: 1;
    border: 1px solid var(--sami-sand);
    border-radius: 20px;
    padding: 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--sami-text);
    background: var(--sami-cream);
    outline: none;
    transition: border-color 0.2s;
}

.sami-input:focus {
    border-color: var(--sami-sage);
}

.sami-input::placeholder {
    color: var(--sami-text-light);
}

.sami-send-btn {
    background: var(--sami-forest);
    color: var(--sami-cream);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sami-send-btn:hover {
    background: var(--sami-dark);
    transform: scale(1.05);
}

.sami-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ═══ FAB (Floating Action Button) ═══ */

.sami-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
    background: var(--sami-forest);
    color: var(--sami-cream);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--sami-shadow);
    transition: all 0.3s ease;
}

.sami-fab:hover {
    background: var(--sami-dark);
    transform: scale(1.1);
}

.sami-fab.sami-fab-hidden {
    display: none;
}

/* ═══ CHOICE MODAL (Néla vs Sami) ═══ */

.sami-choice-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(44, 44, 44, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sami-fade-in 0.2s ease;
    padding: 20px;
}

@keyframes sami-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sami-choice-container {
    background: var(--sami-white);
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--sami-shadow);
    position: relative;
    animation: samiSlideUp 0.3s ease;
}

.sami-choice-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--sami-text-light);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.sami-choice-close-btn:hover {
    color: var(--sami-text);
}

.sami-choice-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--sami-forest);
    text-align: center;
    margin: 0 0 4px 0;
}

.sami-choice-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--sami-text-light);
    text-align: center;
    margin: 0 0 24px 0;
}

.sami-choice-cards {
    display: flex;
    gap: 16px;
}

.sami-choice-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px 18px;
    border-radius: 16px;
    border: 2px solid var(--sami-sand);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
    gap: 6px;
}

.sami-choice-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sami-shadow-light);
}

.sami-choice-card-nela:hover {
    border-color: var(--sami-terracotta);
    background: rgba(198, 123, 92, 0.04);
}

.sami-choice-card-sami:hover {
    border-color: var(--sami-forest);
    background: rgba(61, 90, 61, 0.04);
}

.sami-choice-avatar {
    margin-bottom: 4px;
}

.sami-choice-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--sami-text);
    display: block;
    line-height: 1.2;
}

.sami-choice-role {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--sami-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.sami-choice-desc {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    color: var(--sami-text-light);
    line-height: 1.4;
    display: block;
}

.sami-choice-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 9px 16px;
    border-radius: var(--sami-radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sami-choice-btn-nela {
    background: var(--sami-terracotta);
    color: var(--sami-cream);
}

.sami-choice-card-nela:hover .sami-choice-btn-nela {
    background: #a5654a;
}

.sami-choice-btn-sami {
    background: var(--sami-forest);
    color: var(--sami-cream);
}

.sami-choice-card-sami:hover .sami-choice-btn-sami {
    background: var(--sami-dark);
}

.sami-choice-notice {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    color: var(--sami-text-light);
    margin-top: 6px;
    display: block;
    min-height: 16px;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 768px) {
    .sami-modal {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0;
    }

    .sami-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .sami-chat-header {
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .sami-messages {
        flex: 1;
        min-height: 0;
        padding: 12px;
    }

    .sami-chat-input-area {
        position: sticky;
        bottom: 0;
        z-index: 2;
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: var(--sami-white);
    }

    .sami-fab {
        bottom: 16px;
        right: 16px;
    }

    .sami-choice-cards {
        flex-direction: column;
    }

    .sami-choice-container {
        padding: 24px 20px;
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .sami-choice-overlay {
        padding: 0;
    }
}
