@import url('https://fonts.googleapis.com/css2?family=Pinyon+Script&family=Italiana&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,400&display=swap');
/* Note: IvyPresto is not free or on Google Fonts. Substituting with 'Italiana' which is a similar elegant display serif. */

:root {
    --mina-black: #000000;
    --mina-white: #FFFFFF;
    --mina-fuchsia: #A1005B;
    --mina-powder-pink: #E8D1D5;
    /* Powder Pink per user request */
    --mina-glass: rgba(255, 255, 255, 0.1);
    --mina-glass-border: rgba(255, 255, 255, 0.2);
    --mina-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    --font-header: 'Italiana', serif;
    /* Closest Google Font match for IvyPresto */
    --font-script: 'Pinyon Script', cursive;
    --font-body: 'Cormorant Garamond', serif;
}

/* Reset & Base for Widget Context */
#mina-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: var(--font-body);
    color: var(--mina-black);
}

/* Toggle Button */
#mina-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--mina-black);
    border: 1px solid var(--mina-glass-border);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

#mina-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(161, 0, 91, 0.4);
    /* Fuchsia glow */
}

#mina-toggle-btn svg {
    width: 32px;
    height: 32px;
    fill: var(--mina-white);
    transition: transform 0.3s ease;
}

#mina-toggle-btn.open svg {
    transform: rotate(90deg);
    opacity: 0;
}

#mina-toggle-btn::after {
    content: '✕';
    position: absolute;
    color: var(--mina-white);
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: rotate(-90deg);
}

#mina-toggle-btn.open::after {
    opacity: 1;
    transform: rotate(0);
}

/* Chat Box */
#mina-chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--mina-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
}

#mina-chat-box.active {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

/* Header */
.mina-header {
    background: #000;
    padding: 30px 20px;
    text-align: center;
    color: var(--mina-white);
    position: relative;
    overflow: hidden;
    border-bottom: none;
}

/* Satin Ribbon Texture Overlay */
.mina-header::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: -10%;
    width: 120%;
    height: 40px;
    background: var(--mina-powder-pink);

    /* Satin Ribbon CSS Effect */
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent),
        linear-gradient(to right, #d4b5bb, #f2e1e4, #d4b5bb);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    transform: rotate(-2deg);
    z-index: 0;
    opacity: 0.9;
}

.mina-header-content {
    position: relative;
    z-index: 2;
}

.mina-header h2 {
    font-family: var(--font-header);
    font-size: 32px;
    margin: 0;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.mina-header p {
    font-family: var(--font-script);
    font-size: 20px;
    color: var(--mina-powder-pink);
    /* Matching the ribbon */
    margin: 5px 0 0;
    letter-spacing: 1px;
}

/* Messages Area */
.mina-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

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

.mina-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.9);
    color: var(--mina-black);
    border-radius: 4px 20px 20px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user {
    align-self: flex-end;
    background: var(--mina-black);
    color: var(--mina-white);
    border-radius: 20px 20px 4px 20px;
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    padding: 10px;
    margin-top: 10px;
    border-radius: 8px;
    font-size: 14px;
}

.product-card strong {
    color: var(--mina-fuchsia);
    display: block;
    margin-bottom: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    margin-bottom: 10px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--mina-fuchsia);
    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);
    }
}

/* Input Area */
.mina-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    align-items: center;
}

#mina-input {
    flex: 1;
    border: 1px solid #eee;
    padding: 12px;
    border-radius: 25px;
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    background: #f9f9f9;
}

#mina-input:focus {
    border-color: var(--mina-black);
    background: #fff;
}

#mina-send-btn {
    background: var(--mina-black);
    color: var(--mina-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

#mina-send-btn:hover {
    transform: scale(1.1);
    background: var(--mina-fuchsia);
}

/* Responsive */
@media (max-width: 480px) {
    #mina-chat-box {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    #mina-toggle-btn {
        bottom: 20px;
        right: 20px;
    }

    #mina-close-mobile {
        display: block;
    }
}