/* ========================================
   AI DATING COACH CHAT WIDGET
   ======================================== */

/* Chat Widget Container */
.coach-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* AI Coaching Label */
.coach-chat-label {
    background: white;
    color: #FF6B6B;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    animation: labelEntrance 0.5s ease-out 0.5s forwards;
    pointer-events: none;
    /* Let clicks pass through if needed, but it's just a label */
    border: 1px solid rgba(255, 107, 107, 0.2);
}

@keyframes labelEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coach-chat-widget.open .coach-chat-label {
    display: none;
}

/* ========================================
   FLOATING CHAT BUBBLE (MINIMIZED)
   ======================================== */

.coach-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B6B, #EC4899);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    animation: bubbleEntrance 0.5s ease-out;
}

@keyframes bubbleEntrance {
    0% {
        opacity: 0;
        transform: scale(0) translateY(20px);
    }

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

.coach-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.5);
}

.coach-chat-bubble:active {
    transform: scale(0.95);
}

.bubble-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.bubble-icon svg {
    width: 100%;
    height: 100%;
}

/* Notification Badge */
.bubble-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF5252;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 3px solid white;
    animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

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

/* Pulsing Animation */
.bubble-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B6B, #EC4899);
    opacity: 0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

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

/* Hide bubble when chat is open */
.coach-chat-widget.open .coach-chat-bubble {
    display: none;
}

/* ========================================
   CHAT WINDOW (EXPANDED)
   ======================================== */

.coach-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideIn 0.3s ease-out;
}

@keyframes chatSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

.coach-chat-widget.open .coach-chat-window {
    display: flex;
}

/* Chat Header */
.coach-chat-widget .chat-header {
    background: linear-gradient(135deg, #FF6B6B, #EC4899);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.coach-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.coach-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    flex-shrink: 0;
}

.online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #00D9A3;
    border: 2px solid white;
    border-radius: 50%;
}

.coach-details {
    flex: 1;
}

.coach-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.coach-status {
    font-size: 12px;
    opacity: 0.9;
}

.coach-chat-widget .chat-actions {
    display: flex;
    gap: 8px;
}

.coach-chat-widget .minimize-btn,
.coach-chat-widget .close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.coach-chat-widget .minimize-btn:hover,
.coach-chat-widget .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.coach-chat-widget .minimize-btn svg,
.coach-chat-widget .close-btn svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   CHAT MESSAGES
   ======================================== */

.coach-chat-widget .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F8F9FA;
    scroll-behavior: smooth;
}

/* Scrollbar Styling */
.coach-chat-widget .chat-messages::-webkit-scrollbar {
    width: 6px;
}

.coach-chat-widget .chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.coach-chat-widget .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Message Container */
.coach-chat-widget .message {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

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

.coach-chat-widget .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.coach-chat-widget .message-content {
    flex: 1;
    max-width: 75%;
}

.coach-chat-widget .message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    line-height: 1.5;
    font-size: 14px;
    color: #2D2D2D;
}

.coach-chat-widget .coach-message .message-text {
    border-bottom-left-radius: 4px;
}

.coach-chat-widget .user-message {
    flex-direction: row-reverse;
}

.coach-chat-widget .user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.coach-chat-widget .user-message .message-text {
    background: linear-gradient(135deg, #FF6B6B, #EC4899);
    color: white;
    border-bottom-right-radius: 4px;
}

.coach-chat-widget .message-text ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.coach-chat-widget .message-text li {
    margin: 4px 0;
}

.coach-chat-widget .message-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 4px;
    padding: 0 4px;
}

/* Quick Replies */
.coach-chat-widget .quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.coach-chat-widget .quick-reply-btn {
    background: white;
    border: 2px solid #E0E0E0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #2D2D2D;
    cursor: pointer;
    transition: all 0.2s;
}

.coach-chat-widget .quick-reply-btn:hover {
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.1);
    transform: translateY(-2px);
}

.coach-chat-widget .quick-reply-btn:active {
    transform: translateY(0);
}

/* Typing Indicator */
.coach-chat-widget .typing-indicator {
    display: flex;
    gap: 8px;
    padding: 0 20px 16px;
    background: #F8F9FA;
}

.coach-chat-widget .typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.coach-chat-widget .typing-dots {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 4px;
}

.coach-chat-widget .typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingDot 1.4s infinite;
}

.coach-chat-widget .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.coach-chat-widget .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

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

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ========================================
   CHAT INPUT
   ======================================== */

.coach-chat-widget .chat-input-container {
    background: white;
    border-top: 1px solid #E0E0E0;
    padding: 16px 20px;
    flex-shrink: 0;
}

.coach-chat-widget .chat-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.coach-chat-widget .chat-input {
    flex: 1;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    max-height: 100px;
    transition: border-color 0.2s;
}

.coach-chat-widget .chat-input:focus {
    outline: none;
    border-color: #FF6B6B;
}

.coach-chat-widget .chat-input::placeholder {
    color: #999;
}

.coach-chat-widget .send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B6B, #EC4899);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.coach-chat-widget .send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.coach-chat-widget .send-btn:active {
    transform: scale(0.95);
}

.coach-chat-widget .send-btn svg {
    width: 20px;
    height: 20px;
}

.coach-chat-widget .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.coach-chat-widget .input-footer {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    text-align: center;
}

.coach-chat-widget .input-footer a {
    color: #FF6B6B;
    text-decoration: none;
}

.coach-chat-widget .input-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .coach-chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .coach-chat-bubble {
        width: 56px;
        height: 56px;
    }

    .bubble-icon {
        width: 24px;
        height: 24px;
    }

    .coach-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .coach-chat-widget.open .coach-chat-window {
        position: fixed;
    }

    .coach-chat-widget .message-content {
        max-width: 80%;
    }

    .coach-chat-widget .quick-reply-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .coach-chat-window {
        height: 100vh;
    }
}

/* ========================================
   ANIMATIONS & EFFECTS
   ======================================== */

/* Focus visible for accessibility */
.coach-chat-widget button:focus-visible,
.coach-chat-widget textarea:focus-visible {
    outline: 2px solid #FF6B6B;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .coach-chat-window {
        background: #1A1A1A;
    }

    .coach-chat-widget .chat-messages {
        background: #0D0D0D;
    }

    .coach-chat-widget .coach-message .message-text {
        background: #2D2D2D;
        color: #E0E0E0;
    }

    .coach-chat-widget .message-time {
        color: rgba(255, 255, 255, 0.5);
    }

    .coach-chat-widget .quick-reply-btn {
        background: #2D2D2D;
        border-color: #3D3D3D;
        color: #E0E0E0;
    }

    .coach-chat-widget .typing-indicator,
    .coach-chat-widget .chat-input-container {
        background: #1A1A1A;
    }

    .coach-chat-widget .typing-dots {
        background: #2D2D2D;
    }

    .coach-chat-widget .chat-input {
        background: #2D2D2D;
        border-color: #3D3D3D;
        color: #E0E0E0;
    }

    .coach-chat-widget .chat-input::placeholder {
        color: #666;
    }

    .coach-chat-widget .input-footer {
        color: #666;
    }

    .coach-chat-widget .message-avatar {
        background: #2D2D2D;
    }
}

/* Shake animation for notification */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}