/**
 * Mobile Inline Chat - Simple Collapsible Version
 * Only visible on mobile, placed above title
 * Uses platform blue (#3185fc) theme
 */

/* Only show on mobile when active */
.mobile-inline-chat-simple {
    display: none;
}

.mobile-inline-chat-simple.active {
    display: block;
    width: 100%;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@media (min-width: 769px) {
    .mobile-inline-chat-simple {
        display: none !important;
    }
}

/* Toggle Header */
.mobile-inline-chat-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #2a2a2a;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-inline-chat-toggle-header:active {
    background: #252525;
}

.mobile-chat-toggle-left-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-chat-toggle-icon {
    font-size: 16px;
    color: #3185fc; /* Platform blue */
}

.mobile-chat-toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.mobile-chat-message-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #3185fc; /* Platform blue */
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 6px;
}

.mobile-chat-toggle-chevron {
    font-size: 14px;
    color: #888;
    transition: transform 0.3s ease;
}

/* Expanded state */
.mobile-inline-chat-simple[data-expanded="true"] .mobile-chat-toggle-chevron {
    transform: rotate(180deg);
}

/* Content Area */
.mobile-inline-chat-content-area {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.mobile-inline-chat-simple[data-expanded="true"] .mobile-inline-chat-content-area {
    max-height: calc(100vh - 250px); /* Account for video + some margin */
    overflow: visible;
}

/* Messages Container - Maximize height */
.mobile-inline-messages-container {
    background: #0f0f0f;
    max-height: calc(100vh - 350px); /* viewport - video height - header - input */
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
}

.mobile-inline-messages-container::-webkit-scrollbar {
    width: 3px;
}

.mobile-inline-messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Input Area */
.mobile-inline-chat-input-section {
    position: sticky;
    bottom: 0;
    background: #1a1a1a;
    padding: 10px 12px;
    border-top: 1px solid #333;
    width: 100%;
    box-sizing: border-box;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-inline-chat-input-section {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

.mobile-inline-chat-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.mobile-inline-chat-text-input {
    flex: 1;
    min-width: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 18px;
    padding: 8px 14px;
    color: #ffffff;
    font-size: 16px !important; /* Prevent iOS zoom */
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.mobile-inline-chat-text-input:focus {
    border-color: #3185fc; /* Platform blue */
    background: #333;
}

.mobile-inline-chat-text-input::placeholder {
    color: #666;
    font-size: 16px !important; /* Prevent iOS zoom */
}

.mobile-inline-chat-send-button {
    flex-shrink: 0;
    background: #3185fc; /* Platform blue */
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-inline-chat-send-button:active {
    transform: scale(0.95);
    background: #2a75e6;
}

.mobile-inline-chat-send-button:disabled {
    opacity: 0.5;
}

/* Login Prompt */
.mobile-inline-chat-login-msg {
    padding: 12px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.mobile-inline-chat-login-msg a {
    color: #3185fc; /* Platform blue */
    text-decoration: none;
}

/* Message Styling */
.mobile-inline-messages-container .playervideouserchat {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.mobile-inline-messages-container .leftchat,
.mobile-inline-messages-container .rightchat {
    margin-bottom: 12px;
    animation: fadeIn 0.2s ease;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 375px) {
    .mobile-inline-chat-toggle-header {
        padding: 10px 14px;
    }

    .mobile-chat-toggle-title {
        font-size: 13px;
    }

    /* On small screens, adjust for smaller video */
    .mobile-inline-messages-container {
        max-height: calc(100vh - 320px);
        min-height: 150px;
    }

    .mobile-inline-chat-simple[data-expanded="true"] .mobile-inline-chat-content-area {
        max-height: calc(100vh - 220px);
    }
}
