/* =========================================================================
   Manus WhatsApp Support - Premium Frontend Chat Widget CSS
   ========================================================================= */

.mwps-chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mwps-theme-color: #25D366;
    --mwps-bg-light: #ffffff;
    --mwps-bg-dark: #121b22;
    --mwps-chat-bg: #f5f6f8;
    --mwps-chat-bg-dark: #0b141a;
    --mwps-text-light: #111b21;
    --mwps-text-dark: #e9edef;
    --mwps-bubble-received: #ffffff;
    --mwps-bubble-received-dark: #202c33;
    --mwps-bubble-sent: #dcf8c6;
    --mwps-bubble-sent-dark: #005c4b;
}

/* Float Toggle Button (Premium Circular Design with Glowing Shadow) */
#mwps-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    background: linear-gradient(135deg, var(--mwps-theme-color) 0%, #17b978 100%);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.25), box-shadow 0.2s;
    outline: none;
    padding: 0;
}

#mwps-chat-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.5);
}

#mwps-chat-toggle:active {
    transform: scale(0.95);
}

.mwps-toggle-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.mwps-icon-chat {
    color: white;
    display: block;
}

/* External Floating Tooltip next to the button (Apple/Stripe Style) */
.mwps-chat-tooltip {
    position: absolute;
    bottom: 12px;
    right: 76px;
    background: #ffffff;
    color: #111b21;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    white-space: nowrap;
    border: 1px solid #f0f2f5;
    animation: mwpsTooltipFloat 3s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 999999;
}

@keyframes mwpsTooltipFloat {
    0% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}

.mwps-chat-tooltip::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-right: 1px solid #f0f2f5;
    border-top: 1px solid #f0f2f5;
}

.mwps-icon-close {
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
    color: white;
}

.mwps-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--mwps-theme-color);
    opacity: 0.3;
    z-index: -1;
    animation: mwpsPulse 2.5s infinite;
}

@keyframes mwpsPulse {
    0% { transform: scale(1); opacity: 0.3; }
    70% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

/* Chat Window Box */
#mwps-chat-window {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 120px);
    background: var(--mwps-bg-light);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.1, 0.8, 0.25, 1), opacity 0.2s ease;
    transform-origin: bottom right;
}

.mwps-hidden {
    display: none !important;
    opacity: 0;
    transform: scale(0.85) translateY(20px);
    pointer-events: none;
}

/* Header */
.mwps-chat-header {
    padding: 16px 20px;
    color: white;
    background: linear-gradient(135deg, #2b3648 0%, #3a485c 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.mwps-header-info {
    display: flex;
    align-items: center;
}

.mwps-avatar-container {
    position: relative;
    margin-right: 12px;
}

.mwps-avatar-img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid white;
    background: white;
    object-fit: cover;
    display: block;
}

.mwps-avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 2px solid white;
}

.mwps-avatar-badge-online {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background-color: #00e676;
    border: 2px solid #2b3648;
    border-radius: 50%;
}

.mwps-header-info h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.mwps-header-info p {
    margin: 2px 0 0 0;
    font-size: 11.5px;
    color: #a4b2c1;
}

#mwps-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
    line-height: 1;
}

#mwps-chat-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Giriş Ekranı (Daha geniş ve ferah, premium tasarım) */
.mwps-chat-welcome-screen {
    position: absolute;
    top: 74px;
    left: 0;
    width: 100%;
    height: calc(100% - 74px);
    background: #ffffff;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 24px 28px;
    box-sizing: border-box;
    overflow-y: auto; /* Dikeyde sığmazsa kaydırılabilsin */
    justify-content: space-between;
}

.mwps-welcome-hero {
    text-align: center;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mwps-hero-icon-svg {
    margin-bottom: 12px;
    width: 56px;
    height: 56px;
    background: rgba(37, 211, 102, 0.08);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--mwps-theme-color);
}

.mwps-hero-icon-svg svg {
    width: 28px !important;
    height: 28px !important;
}

.mwps-welcome-hero h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #111b21;
    font-weight: 600;
}

.mwps-welcome-hero p {
    margin: 0;
    font-size: 12.5px;
    color: #667781;
    line-height: 1.5;
}

.mwps-welcome-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    justify-content: center;
}

.mwps-form-group input[type="text"],
.mwps-form-group input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e7eb;
    border-radius: 10px;
    font-size: 13.5px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
    background: #fafafa;
}

.mwps-form-group input:focus {
    border-color: var(--mwps-theme-color);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

.gdpr-group {
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #f0f2f5;
}

.mwps-checkbox-label {
    display: flex;
    gap: 8px;
    cursor: pointer;
    align-items: flex-start;
}

.mwps-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}

.mwps-checkbox-text {
    font-size: 11px;
    color: #54656f;
    line-height: 1.4;
}

.mwps-btn-actions-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.mwps-btn-primary {
    background: var(--mwps-theme-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.mwps-btn-primary:hover {
    filter: brightness(0.95);
}

.mwps-btn-primary:active {
    transform: scale(0.98);
}

.mwps-btn-link {
    background: none;
    border: none;
    color: #667781;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.2s;
    font-weight: 600;
}

.mwps-btn-link:hover {
    color: #2b3648;
    text-decoration: underline;
}

/* Chat Body (Messages List) */
.mwps-chat-body {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
    background: var(--mwps-chat-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Message Bubble with Avatar wrapper */
.mwps-received-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    align-self: flex-start;
    max-width: 80%;
}

.mwps-received-wrapper .mwps-message {
    max-width: 100%;
    margin: 0;
}

.mwps-widget-bubble-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    flex-shrink: 0;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.mwps-widget-bubble-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(43, 54, 72, 0.1);
    color: #2b3648;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.mwps-message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mwps-received {
    align-self: flex-start;
    background: var(--mwps-bubble-received);
    color: var(--mwps-text-light);
    border-bottom-left-radius: 2px;
}

.mwps-sent {
    align-self: flex-end;
    background: var(--mwps-bubble-sent);
    color: var(--mwps-text-light);
    border-bottom-right-radius: 2px;
}

.mwps-message-content {
    word-break: break-word;
}

.mwps-msg-time-stamp {
    font-size: 9.5px;
    color: #8696a0;
    display: block;
    text-align: right;
    margin-top: 3px;
}

/* Chat Footer & Input Area */
.mwps-chat-footer {
    padding: 10px 14px 12px 14px;
    background: var(--mwps-bg-light);
    border-top: 1px solid #f0f2f5;
}

.mwps-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mwps-input-area input {
    flex: 1;
    border: 1px solid #e1e7eb;
    padding: 8px 14px;
    border-radius: 20px;
    outline: none;
    font-size: 13px;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mwps-input-area input:focus {
    border-color: var(--mwps-theme-color);
}

#mwps-send-btn {
    background: var(--mwps-theme-color);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#mwps-send-btn svg {
    fill: #ffffff !important;
    color: #ffffff !important;
    display: block;
}

#mwps-send-btn svg path {
    fill: #ffffff !important;
}

#mwps-send-btn:hover {
    filter: brightness(0.92);
}

#mwps-send-btn:active {
    transform: scale(0.95);
}

.mwps-message img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    margin-top: 4px;
}

/* Sub Footer Bar (Tools & Branding) */
.mwps-footer-sub-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.mwps-footer-tools {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mwps-tool-icon {
    font-size: 15px;
    color: #a4b2c1;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
    line-height: 1;
}

.mwps-tool-icon:hover {
    color: #667781;
}

.mwps-powered-by {
    font-size: 10px;
    color: #8696a0;
    user-select: none;
}

.mwps-powered-brand {
    font-weight: 700;
    color: #667781;
}

/* Custom Scrollbar */
.mwps-chat-body::-webkit-scrollbar {
    width: 5px;
}
.mwps-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.mwps-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* =========================================================================
   Dark Mode Settings
   ========================================================================= */
.mwps-dark #mwps-chat-window {
    background: var(--mwps-bg-dark);
}

.mwps-dark .mwps-chat-welcome-screen {
    background: var(--mwps-bg-dark);
}

.mwps-dark .mwps-welcome-hero h4 {
    color: var(--mwps-text-dark);
}

.mwps-dark .gdpr-group {
    background: #182229;
    border-color: #222e35;
}

.mwps-dark .mwps-checkbox-text {
    color: #8696a0;
}

.mwps-dark .mwps-form-group input {
    background: #2a3942;
    border-color: #222e35;
    color: var(--mwps-text-dark);
}

.mwps-dark .mwps-chat-body {
    background: var(--mwps-chat-bg-dark);
}

.mwps-dark .mwps-received {
    background: var(--mwps-bubble-received-dark);
    color: var(--mwps-text-dark);
}

.mwps-dark .mwps-sent {
    background: var(--mwps-bubble-sent-dark);
    color: var(--mwps-text-dark);
}

.mwps-dark .mwps-msg-time-stamp {
    color: #8696a0;
}

.mwps-dark .mwps-chat-footer {
    background: #1f2c34;
    border-top-color: #222e35;
}

.mwps-dark .mwps-input-area input {
    background: #2a3942;
    border-color: #2a3942;
    color: var(--mwps-text-dark);
}

.mwps-dark .mwps-powered-by {
    color: #667781;
}

.mwps-dark .mwps-powered-brand {
    color: #a4b2c1;
}

.mwps-dark .mwps-widget-bubble-avatar-placeholder {
    background: rgba(255, 255, 255, 0.15);
    color: #e9edef;
}

.mwps-dark .mwps-btn-link {
    color: #8696a0;
}

.mwps-dark .mwps-btn-link:hover {
    color: #ffffff;
}

.mwps-dark .mwps-chat-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

/* =========================================================================
   Responsive Styling for Mobile Devices
   ========================================================================= */
@media (max-width: 480px) {
    .mwps-chat-container {
        bottom: 80px;
        right: 20px;
    }
    #mwps-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        z-index: 99999999;
    }
    .mwps-chat-header {
        border-radius: 0;
    }
    .mwps-chat-welcome-screen {
        height: calc(100% - 74px);
        padding: 20px 24px;
    }
    .mwps-chat-tooltip {
        display: none !important;
    }
}
