/**
 * A-State Qatar Chatbot Styles - Modern Professional Design
 * 
 * @package AStateQatarChatbot
 */

/* Reset and base styles */
.astate-chatbot-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #2d3748;
    background: #ffffff;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(10px);
}

.astate-chatbot-container * {
    box-sizing: border-box;
}

/* Fixed position chatbot */
.astate-chatbot-container.astate-chatbot-fixed {
    position: fixed;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 40px);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Widget positions */
.astate-chatbot-container.astate-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

.astate-chatbot-container.astate-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

.astate-chatbot-container.astate-chatbot-top-right {
    top: 20px;
    right: 20px;
}

.astate-chatbot-container.astate-chatbot-top-left {
    top: 20px;
    left: 20px;
}

/* Dark theme */
.astate-chatbot-container.astate-chatbot-dark {
    background: #1a202c;
    color: #e2e8f0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Header - Modern gradient design */
.astate-chatbot-header {
    background: linear-gradient(135deg, #cc092f 0%, #a0071e 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.astate-chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.1;
}

.astate-chatbot-dark .astate-chatbot-header {
    background: linear-gradient(135deg, #a0071e 0%, #800617 100%);
}

.astate-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    z-index: 1;
}

.astate-chatbot-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.astate-chatbot-avatar svg {
    color: white;
    width: 28px;
    height: 28px;
}

.astate-chatbot-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.astate-chatbot-title p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
    line-height: 1.3;
}

.astate-chatbot-toggle {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.astate-chatbot-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Messages area - Modern scrollbar */
.astate-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
    background: #f8fafc;
    position: relative;
}

.astate-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.astate-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.astate-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 224, 0.6);
    border-radius: 3px;
}

.astate-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(160, 174, 192, 0.8);
}

.astate-chatbot-dark .astate-chatbot-messages {
    background: #2d3748;
}

.astate-chatbot-dark .astate-chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(74, 85, 104, 0.6);
}

.astate-chatbot-welcome {
    margin-bottom: 24px;
}

/* Messages - Modern bubble design */
.astate-chatbot-message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
    gap: 12px;
    animation: astate-chatbot-message-appear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.astate-chatbot-message-user {
    flex-direction: row-reverse;
}

.astate-chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #cc092f;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(204, 9, 47, 0.2);
}

.astate-chatbot-message-user .astate-chatbot-message-avatar {
    background: #cc092f;
}

.astate-chatbot-dark .astate-chatbot-message-avatar {
    background: #a0071e;
    box-shadow: 0 4px 6px -1px rgba(160, 7, 30, 0.3);
}

.astate-chatbot-message-content {
    flex: 1;
    max-width: calc(100% - 44px);
}

.astate-chatbot-message-text {
    padding: 16px 20px;
    border-radius: 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
}

.astate-chatbot-message-assistant .astate-chatbot-message-text {
    background: #ffffff;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.astate-chatbot-message-user .astate-chatbot-message-text {
    background: linear-gradient(135deg, #cc092f 0%, #a0071e 100%);
    color: white;
    border-top-right-radius: 8px;
    margin-left: auto;
    box-shadow: 0 4px 6px -1px rgba(204, 9, 47, 0.2);
}

.astate-chatbot-dark .astate-chatbot-message-assistant .astate-chatbot-message-text {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
}

.astate-chatbot-dark .astate-chatbot-message-user .astate-chatbot-message-text {
    background: linear-gradient(135deg, #a0071e 0%, #800617 100%);
}

/* Links in messages */
.astate-chatbot-message-text a {
    color: #cc092f;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.astate-chatbot-message-text a:hover {
    color: #a0071e;
}

.astate-chatbot-message-user .astate-chatbot-message-text a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.astate-chatbot-dark .astate-chatbot-message-text a {
    color: #ff6b8a;
}

/* Message meta */
.astate-chatbot-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 0 4px;
}

.astate-chatbot-message-user .astate-chatbot-message-meta {
    justify-content: flex-end;
}

.astate-chatbot-message-time {
    font-size: 11px;
    color: #a0aec0;
    font-weight: 500;
}

.astate-chatbot-copy {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    color: #a0aec0;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.astate-chatbot-message:hover .astate-chatbot-copy {
    opacity: 1;
}

.astate-chatbot-copy:hover {
    background: #f7fafc;
    color: #2d3748;
    transform: scale(1.1);
}

.astate-chatbot-dark .astate-chatbot-copy:hover {
    background: #4a5568;
    color: #e2e8f0;
}

/* Typing indicator - Enhanced */
.astate-chatbot-typing {
    margin-bottom: 20px;
}

.astate-chatbot-typing-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    border-top-left-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.astate-chatbot-dark .astate-chatbot-typing-dots {
    background: #4a5568;
    border-color: #718096;
}

.astate-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    border-radius: 50%;
    animation: astate-chatbot-typing-pulse 1.4s infinite ease-in-out;
}

.astate-chatbot-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.astate-chatbot-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes astate-chatbot-typing-pulse {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Input area - Modern design */
.astate-chatbot-input-container {
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    padding: 20px 24px;
    flex-shrink: 0;
}

.astate-chatbot-dark .astate-chatbot-input-container {
    border-top-color: #4a5568;
    background: #2d3748;
}

/* Suggestions - Modern pills */
.astate-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.astate-chatbot-suggestion {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.astate-chatbot-suggestion:hover {
    background: #cc092f;
    color: white;
    border-color: #cc092f;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(204, 9, 47, 0.2);
}

.astate-chatbot-dark .astate-chatbot-suggestion {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
}

.astate-chatbot-dark .astate-chatbot-suggestion:hover {
    background: #a0071e;
    border-color: #a0071e;
}

/* Form - Clean, modern input */
.astate-chatbot-form {
    display: flex;
    flex-direction: column;
}

.astate-chatbot-input-wrapper {
    position: relative;
    width: 100%;
}

.astate-chatbot-input {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    background: #ffffff;
    color: #2d3748;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.astate-chatbot-input:focus {
    border-color: #cc092f;
    box-shadow: 0 0 0 3px rgba(204, 9, 47, 0.1);
    background: #ffffff;
}

.astate-chatbot-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.astate-chatbot-dark .astate-chatbot-input {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.astate-chatbot-dark .astate-chatbot-input:focus {
    border-color: #a0071e;
    box-shadow: 0 0 0 3px rgba(160, 7, 30, 0.1);
}

.astate-chatbot-dark .astate-chatbot-input::placeholder {
    color: #a0aec0;
}

.astate-chatbot-input-hint {
    margin-top: 8px;
    text-align: center;
}

.astate-chatbot-input-hint span {
    font-size: 11px;
    color: #a0aec0;
    font-weight: 500;
    padding: 4px 8px;
    background: #f7fafc;
    border-radius: 6px;
    display: inline-block;
}

.astate-chatbot-dark .astate-chatbot-input-hint span {
    background: #4a5568;
    color: #a0aec0;
}

/* Footer */
.astate-chatbot-footer {
    margin-top: 12px;
    text-align: center;
}

.astate-chatbot-footer p {
    margin: 0;
    font-size: 10px;
    color: #a0aec0;
    line-height: 1.4;
    font-weight: 400;
}

.astate-chatbot-dark .astate-chatbot-footer p {
    color: #718096;
}

/* Widget button - Modern floating action button */
.astate-chatbot-widget-button {
    position: fixed;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #cc092f 0%, #a0071e 100%);
    box-shadow: 0 10px 25px rgba(204, 9, 47, 0.3), 0 4px 6px rgba(204, 9, 47, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
}

.astate-chatbot-widget-button:hover {
    background: linear-gradient(135deg, #a0071e 0%, #800617 100%);
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(204, 9, 47, 0.4), 0 8px 15px rgba(204, 9, 47, 0.3);
}

.astate-chatbot-widget-button:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(204, 9, 47, 0.2), 0 10px 25px rgba(204, 9, 47, 0.3);
}

.astate-chatbot-widget-button.astate-chatbot-bottom-right {
    bottom: 24px;
    right: 24px;
}

.astate-chatbot-widget-button.astate-chatbot-bottom-left {
    bottom: 24px;
    left: 24px;
}

.astate-chatbot-widget-button.astate-chatbot-top-right {
    top: 24px;
    right: 24px;
}

.astate-chatbot-widget-button.astate-chatbot-top-left {
    top: 24px;
    left: 24px;
}

.astate-chatbot-widget-icon {
    color: white;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.astate-chatbot-widget-button:hover .astate-chatbot-widget-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Widget states */
.astate-chatbot-container.astate-chatbot-widget-hidden {
    display: none;
}

.astate-chatbot-container.astate-chatbot-widget-visible {
    display: flex;
    animation: astate-chatbot-widget-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.astate-chatbot-widget-button.astate-chatbot-widget-hidden {
    display: none;
}

/* Animations */
@keyframes astate-chatbot-widget-slide-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes astate-chatbot-message-appear {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state */
.astate-chatbot-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.astate-chatbot-input.astate-chatbot-loading {
    border-color: #cc092f;
    box-shadow: 0 0 0 3px rgba(204, 9, 47, 0.1);
    position: relative;
}

.astate-chatbot-input.astate-chatbot-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 16px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #cc092f;
    border-right-color: transparent;
    border-radius: 50%;
    animation: astate-chatbot-spin 1s linear infinite;
}

@keyframes astate-chatbot-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design - Mobile first approach */
@media (max-width: 768px) {
    .astate-chatbot-container.astate-chatbot-fixed {
        width: calc(100vw - 32px);
        height: calc(100vh - 40px);
        max-width: none;
        border-radius: 20px 20px 0 0;
    }
    
    .astate-chatbot-container.astate-chatbot-bottom-right,
    .astate-chatbot-container.astate-chatbot-bottom-left {
        bottom: 0;
        left: 16px;
        right: 16px;
    }
    
    .astate-chatbot-container.astate-chatbot-top-right,
    .astate-chatbot-container.astate-chatbot-top-left {
        top: 20px;
        left: 16px;
        right: 16px;
        height: calc(100vh - 60px);
    }
    
    .astate-chatbot-header {
        padding: 16px 20px;
        min-height: 70px;
    }
    
    .astate-chatbot-avatar {
        width: 40px;
        height: 40px;
    }
    
    .astate-chatbot-avatar svg {
        width: 24px;
        height: 24px;
    }
    
    .astate-chatbot-title h3 {
        font-size: 16px;
    }
    
    .astate-chatbot-title p {
        font-size: 12px;
    }
    
    .astate-chatbot-messages {
        padding: 16px 20px;
    }
    
    .astate-chatbot-input-container {
        padding: 16px 20px;
    }
    
    .astate-chatbot-suggestions {
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .astate-chatbot-suggestion {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .astate-chatbot-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
    
    .astate-chatbot-widget-button {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
    }
    
    .astate-chatbot-widget-button.astate-chatbot-bottom-left {
        bottom: 20px;
        left: 20px;
    }
    
    .astate-chatbot-widget-button svg {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .astate-chatbot-container.astate-chatbot-fixed {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    .astate-chatbot-header {
        padding: 14px 16px;
        min-height: 60px;
    }
    
    .astate-chatbot-messages {
        padding: 12px 16px;
    }
    
    .astate-chatbot-input-container {
        padding: 12px 16px;
    }
    
    .astate-chatbot-message {
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .astate-chatbot-message-avatar {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }
    
    .astate-chatbot-message-avatar svg {
        width: 14px;
        height: 14px;
    }
    
    .astate-chatbot-message-text {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .astate-chatbot-container {
        border: 2px solid #000000;
    }
    
    .astate-chatbot-input {
        border-width: 2px;
    }
    
    .astate-chatbot-message-assistant .astate-chatbot-message-text {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .astate-chatbot-message,
    .astate-chatbot-typing-dots span,
    .astate-chatbot-widget-slide-in,
    .astate-chatbot-message-appear {
        animation: none;
    }
    
    .astate-chatbot-container,
    .astate-chatbot-widget-button,
    .astate-chatbot-suggestion,
    .astate-chatbot-copy,
    .astate-chatbot-toggle,
    .astate-chatbot-input {
        transition: none;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: dark) {
    .astate-chatbot-container:not(.astate-chatbot-dark) {
        background: #1a202c;
        color: #e2e8f0;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    }
}