/**
 * Paladium RealtyOS - Frontend Chat Widget Styles
 */

#paladium-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Toggle Button */
.paladium-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #122e5c, #0d2248);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(93, 58, 122, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}

.paladium-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(93, 58, 122, 0.5);
}

/* Chat Window */
.paladium-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.paladium-chat-header {
    background: linear-gradient(135deg, #122e5c, #0d2248);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.paladium-chat-logo {
    height: 32px;
    width: auto;
}

.paladium-chat-header span {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
}

.paladium-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.paladium-chat-close:hover {
    opacity: 1;
}

/* Pre-chat Form */
.paladium-prechat-form {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.paladium-prechat-form h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: #1F2937;
}

.paladium-prechat-form p {
    margin: 0 0 20px;
    color: #6B7280;
    font-size: 14px;
}

#paladium-prechat {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#paladium-prechat input {
    padding: 14px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#paladium-prechat input:focus {
    outline: none;
    border-color: #122e5c;
    box-shadow: 0 0 0 3px rgba(93, 58, 122, 0.1);
}

#paladium-prechat button {
    padding: 14px;
    background: #122e5c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

#paladium-prechat button:hover {
    background: #0d2248;
}

.paladium-legal {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 5px 0;
    font-size: 13px;
    color: #6B7280;
    text-align: left;
}

.paladium-legal input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin-top: 2px !important;
    cursor: pointer;
}

.paladium-legal label {
    line-height: 1.4;
    cursor: pointer;
}

.paladium-legal a {
    color: #122e5c;
    text-decoration: underline;
    font-weight: 600;
}

/* Chat Messages */
.paladium-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.paladium-messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.paladium-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-line;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.paladium-message-user {
    align-self: flex-end;
    background: #122e5c;
    color: white;
    border-bottom-right-radius: 4px;
}

.paladium-message-ai,
.paladium-message-agent {
    align-self: flex-start;
    background: #F3F4F6;
    color: #1F2937;
    border-bottom-left-radius: 4px;
}

/* Property Buttons in Messages */
.paladium-property-btn {
    display: inline-block;
    background: linear-gradient(135deg, #122e5c, #0d2248);
    color: white !important;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    margin: 6px 0;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(93, 58, 122, 0.3);
}

.paladium-property-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 58, 122, 0.4);
    color: white !important;
}

/* Property Card in Message */
.paladium-property-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #E5E7EB;
}

.paladium-property-card .property-name {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
}

.paladium-property-card .property-price {
    color: #122e5c;
    font-weight: 700;
    font-size: 16px;
}

.paladium-property-card .property-details {
    color: #6B7280;
    font-size: 12px;
    margin-top: 4px;
}

/* Chat Input */
.paladium-chat-input {
    border-top: 1px solid #E5E7EB;
    padding: 16px;
}

#paladium-message-form {
    display: flex;
    gap: 10px;
}

#paladium-message {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 24px;
    font-size: 14px;
    transition: border-color 0.2s;
}

#paladium-message:focus {
    outline: none;
    border-color: #122e5c;
}

#paladium-message:disabled {
    background: #F9FAFB;
    color: #9CA3AF;
}

#paladium-message-form button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #122e5c;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#paladium-message-form button:hover {
    background: #0d2248;
}

/* Typing Indicator */
.paladium-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #F3F4F6;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 60px;
}

.paladium-typing span {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.paladium-typing span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .paladium-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .paladium-chat-toggle {
        bottom: 10px;
        right: 10px;
    }
}

/* Agent Online Status */
.paladium-agent-status {
    padding: 20px 24px;
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-bottom: 1px solid #BBF7D0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.agent-avatar-container {
    position: relative;
}

.agent-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #10B981;
}

.agent-online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.agent-info {
    flex: 1;
}

.agent-greeting {
    margin: 0;
    font-size: 15px;
    color: #065F46;
    font-weight: 500;
}

.agent-greeting strong {
    font-weight: 700;
    color: #047857;
}

.agent-subtitle {
    margin: 4px 0 0;
    font-size: 12px;
    color: #059669;
}

/* Offline Message */
.paladium-offline-message {
    padding: 20px 24px;
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    border-bottom: 1px solid #FECACA;
    text-align: center;
}

.paladium-offline-message p {
    margin: 0 0 4px;
    font-size: 15px;
    color: #991B1B;
}

.paladium-offline-message p strong {
    font-weight: 700;
}

.offline-subtitle {
    margin: 4px 0 0 !important;
    font-size: 12px !important;
    color: #DC2626 !important;
}

.paladium-field {
    margin-bottom: 12px;
}

/* Tooltip Notification */
.paladium-chat-tooltip {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(93, 58, 122, 0.25);
    max-width: 250px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 999998;
}

.paladium-chat-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.paladium-chat-tooltip .tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.paladium-chat-tooltip .tooltip-close:hover {
    background: #F3F4F6;
    color: #4B5563;
}

.paladium-chat-tooltip .tooltip-content {
    padding-right: 20px;
}

.paladium-chat-tooltip strong {
    display: block;
    color: #1F2937;
    font-size: 15px;
    margin-bottom: 4px;
}

.paladium-chat-tooltip p {
    color: #6B7280;
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}

/* Chat Notification Badge */
.paladium-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
    animation: pulse-badge 1s ease-in-out;
}

.paladium-chat-toggle {
    position: relative;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(93, 58, 122, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 30px rgba(93, 58, 122, 0.6);
    }
}