/* Ready Franchise Builder - Chat Widget Styles */
/* TRANSPARENT VERSION for embedding with PULSING ANIMATION */

:root {
    --rfb-black: #000000;
    --rfb-neon-green: #43FF56;
    --rfb-gray: #545454;
    --rfb-white: #FFFFFF;
    --rfb-light-gray: #f5f5f5;
    --rfb-border: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: transparent !important;
}

/* Pulsing animation for chat button */
@keyframes pulse {
    0% {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 40px rgba(67, 255, 86, 0.8);
        transform: scale(1.08);
    }
    100% {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
        transform: scale(1);
    }
}

/* Chat Toggle Button with Pulsing */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--rfb-black);
    border: 3px solid var(--rfb-neon-green);
    color: var(--rfb-neon-green);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 9999;
    animation: pulse 2s infinite; /* PULSING ANIMATION */
}

.chat-toggle.clicked {
    animation: none; /* Stop pulsing after clicked */
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(67, 255, 86, 0.5);
    animation: none; /* Stop pulsing on hover */
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
}

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 480px;
    height: 85vh;
    max-height: 800px;
    background: var(--rfb-white);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 10000;
}

.chat-widget.hidden {
    display: none;
}

/* Chat Header */
.chat-header {
    background: var(--rfb-black);
    color: var(--rfb-white);
    padding: 18px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--rfb-neon-green);
    flex-shrink: 0;
}

.chat-header-content h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-header-content p {
    margin: 0;
    font-size: 13px;
    color: var(--rfb-neon-green);
    opacity: 0.95;
}

.chat-close {
    background: transparent;
    border: none;
    color: var(--rfb-white);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--rfb-neon-green);
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: var(--rfb-light-gray);
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--rfb-gray);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--rfb-black);
}

/* Individual Messages */
.message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    padding: 14px 18px;
    border-radius: 12px;
    max-width: 90%;
    line-height: 1.6;
    font-size: 15px;
}

.assistant-message .message-content {
    background: var(--rfb-white);
    border: 1px solid var(--rfb-border);
    margin-right: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: var(--rfb-black);
    color: var(--rfb-white);
    margin-left: auto;
    border: 2px solid var(--rfb-neon-green);
}

.message-content p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 10px 0;
    padding-left: 22px;
}

.message-content li {
    margin: 6px 0;
    line-height: 1.6;
}

.message-content strong {
    font-weight: 600;
    color: var(--rfb-neon-green);
}

.user-message .message-content strong {
    color: var(--rfb-white);
}

/* Links in messages */
.message-content a {
    color: var(--rfb-neon-green);
    text-decoration: underline;
    font-weight: 600;
    word-break: break-word;
}

.message-content a:hover {
    color: #35cc45;
}

.user-message .message-content a {
    color: var(--rfb-white);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rfb-gray);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Error Messages */
.error-message {
    background: #fee;
    color: #c00;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 14px;
    animation: shake 0.5s;
    border-left: 4px solid #c00;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Chat Input Form */
.chat-input-form {
    padding: 20px;
    background: var(--rfb-white);
    border-top: 1px solid var(--rfb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--rfb-black);
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--rfb-neon-green);
    box-shadow: 0 0 0 3px rgba(67, 255, 86, 0.1);
}

.chat-submit {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--rfb-black);
    border: 2px solid var(--rfb-neon-green);
    color: var(--rfb-neon-green);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-submit:hover {
    background: var(--rfb-neon-green);
    color: var(--rfb-black);
    transform: scale(1.05);
}

.chat-submit:active {
    transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .chat-header {
        border-radius: 0;
        padding: 16px 20px;
    }

    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
    }

    .chat-toggle svg {
        width: 26px;
        height: 26px;
    }

    .message-content {
        max-width: 95%;
        font-size: 14px;
    }

    .chat-input {
        font-size: 16px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .chat-widget {
        width: 440px;
        height: 80vh;
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .chat-widget {
        height: 80vh;
        max-height: 900px;
    }
}

/* Accessibility */
.chat-toggle:focus,
.chat-close:focus,
.chat-submit:focus,
.chat-input:focus {
    outline: 2px solid var(--rfb-neon-green);
    outline-offset: 2px;
}

/* Print */
@media print {
    .chat-widget,
    .chat-toggle {
        display: none !important;
    }
}