/* Uurinmäki AI Chatbot Styles */
:root {
    --chat-primary: #EE181A;
    /* Uurinmäki Red */
    --chat-primary-dark: #cc1517;
    --chat-accent: #f8f9fa;
    --chat-text: #333;
    --chat-bg: #fff;
    --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    --chat-border: #e1e4e8;
}

.chat-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    background-color: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    z-index: 1500;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: chat-bubble-pulse 2s infinite;
}

.chat-bubble:hover {
    transform: scale(1.1) rotate(5deg);
    background-color: var(--chat-primary-dark);
}

.chat-bubble svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.chat-bubble-label {
    position: fixed;
    bottom: 35px;
    right: 100px;
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1499;
    pointer-events: none;
    transition: all 0.3s ease;
    animation: chat-pulse 3s infinite;
}

@keyframes chat-pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}

.chat-bubble-label::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #333;
}

.chat-window {
    position: fixed;
    bottom: 105px;
    right: 25px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 130px);
    background-color: var(--chat-bg);
    border-radius: 16px;
    box-shadow: var(--chat-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1500;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    border: 1px solid var(--chat-border);
}

.chat-window.active {
    display: flex;
    animation: chat-slideIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes chat-slideIn {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.chat-header {
    background-color: var(--chat-primary);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.chat-header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-header-actions span {
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-header-actions span:hover {
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #fcfcfc;
}

.message {
    padding: 12px 16px;
    border-radius: 14px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot {
    background-color: #fff;
    border: 1px solid var(--chat-border);
    align-self: flex-start;
    color: #262626;
    border-bottom-left-radius: 2px;
}

.message.user {
    background-color: var(--chat-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message strong {
    font-weight: 700;
}

.chat-phone-link {
    display: inline-block;
    background: #f1f3f5;
    color: var(--chat-primary) !important;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 700;
    margin: 4px 0;
    border: 1px solid var(--chat-border);
    transition: all 0.2s;
}

.chat-phone-link:hover {
    background: var(--chat-primary);
    color: white !important;
    border-color: var(--chat-primary);
}

.chat-suggestions {
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--chat-border);
    background: #fff;
}

.suggestion-btn {
    background: #f8f9fa;
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.suggestion-btn:hover {
    background: var(--chat-primary);
    border-color: var(--chat-primary);
    color: white;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
    background: #fff;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--chat-border);
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--chat-primary);
}

.chat-send {
    background-color: var(--chat-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send:hover {
    background-color: var(--chat-primary-dark);
}

.typing-indicator {
    font-style: italic;
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Contact Form Overaly */
.chat-contact-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--chat-bg);
    display: none;
    flex-direction: column;
    z-index: 1510;
}

.chat-contact-form.active {
    display: flex;
    animation: chat-fadeIn 0.3s ease;
}

@keyframes chat-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.chat-contact-form .form-header {
    background-color: #333;
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-contact-form .form-body {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
}

.chat-contact-form .form-group {
    margin-bottom: 15px;
}

.chat-contact-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    /* Explicit dark text for labels on white bg */
}

.chat-contact-form input,
.chat-contact-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    /* More visible border */
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: #ffffff;
    /* Explicit white background */
    color: #333;
    /* Explicit dark text */
}

.chat-contact-form .form-submit {
    width: 100%;
    background-color: var(--chat-primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 10px;
}

.chat-contact-form .honeypot {
    position: absolute;
    left: -9999px;
}

@media (max-width: 480px) {
    .chat-window {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 80px;
        height: 550px;
        /* Force taller height */
        max-height: calc(100vh - 100px);
    }

    .chat-bubble-label {
        display: none;
    }
}

@keyframes chat-bubble-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(238, 24, 26, 0.7);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(238, 24, 26, 0);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(238, 24, 26, 0);
        transform: scale(1);
    }
}

/* Landscape optimization for mobile (very short screens) */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-window {
        bottom: 5px;
        right: 5px;
        left: 5px;
        width: auto;
        height: calc(100vh - 10px);
        max-height: none;
        border-radius: 8px;
    }

    .chat-header {
        padding: 5px 15px;
    }

    .chat-header h3 {
        font-size: 0.95rem;
    }

    .chat-messages {
        padding: 5px 15px;
    }

    .message {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .chat-suggestions {
        padding: 5px;
        gap: 5px;
    }

    .suggestion-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .chat-input-area {
        padding: 5px 10px;
    }

    .chat-input {
        padding: 8px 12px;
    }

    .chat-send {
        width: 36px;
        height: 36px;
    }

    .chat-bubble {
        display: flex;
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    .chat-bubble svg {
        width: 24px;
        height: 24px;
    }

    .chat-bubble-label {
        display: none;
        /* Hide label in landscape to avoid clutter */
    }
}