/* Chat-specific styles for keeneisd.xyz */

/* Chat Layout */
.chat-layout {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

/* Sidebar Panel */
.sidebar-panel {
    width: 250px;
    background: #1a1a1a;
    border-radius: 12px;
    border: 2px solid #1a1a1a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    padding: 1rem;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #1a1a1a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    flex: 1;
}

/* Chat Header */
.chat-header {
    background: #2a2a2a;
    padding: 1rem 2rem;
    border-bottom: 2px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h2 {
    margin: 0;
    color: #e0e7ef;
    font-size: 1.5rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    color: #007acc;
    font-weight: 500;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

/* Individual Messages - Discord Style */
.message {
    display: flex;
    padding: 0.5rem 1rem;
    margin: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.1s ease;
    animation: fadeInMessage 0.3s ease-out;
}

.message:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Message Content Structure */
.message-wrapper {
    display: flex;
    width: 100%;
    gap: 1rem;
}

/* Message Header - inline with content */
.message-header {
    display: inline;
    margin: 0;
    padding: 0;
}

.message-sender {
    font-weight: 600;
    color: #b9bbbe;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.message.own .message-sender {
    color: #b9bbbe;
}

.message-time {
    font-size: 0.75rem;
    color: #72767d;
    margin-left: 0.25rem;
}

/* Message Content - clean Discord style */
.message-content {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    line-height: 1.375;
    color: #dcddde;
    font-size: 1rem;
    word-wrap: break-word;
    margin: 0;
}

/* Delete button for admin users */
.delete-message-btn {
    background: none !important;
    border: none !important;
    color: #ff4444 !important;
    cursor: pointer !important;
    font-size: 0.8rem !important;
    margin-left: 0.5rem !important;
    opacity: 0 !important;
    transition: all 0.2s ease !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

.delete-message-btn:hover {
    background: rgba(255, 68, 68, 0.1) !important;
    opacity: 1 !important;
}

/* Input Container */
.input-container {
    padding: 1rem 2rem;
    background: #0f0f0f;
    border-top: 2px solid #333;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
}

/* Input Wrapper - contains the input with embedded buttons */
.input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: #0f0f0f;
    border: 2px solid #444;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #b9bbbe;
    box-shadow: 0 0 0 3px rgba(185, 188, 190, 0.1);
}

/* Message Input */
.message-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 3rem 0.75rem 3rem; /* Left padding for plus button, right for send button */
    color: #e0e7ef;
    font-size: 1rem;
    outline: none;
    resize: none;
    min-height: 20px;
    max-height: 100px;
    font-family: inherit;
}

.message-input::placeholder {
    color: #666;
}

/* Plus Button - positioned inside input on the left */
.plus-btn {
    position: absolute;
    left: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s ease;
    color: #b9bbbe;
    width: 28px;
    height: 28px;
    z-index: 1;
}

.plus-btn:hover {
    background: rgba(185, 188, 190, 0.1);
    color: #e0e7ef;
}

/* Send Button - positioned inside input on the right */
.send-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    color: #b9bbbe;
    border: none;
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    z-index: 1;
}

.send-btn:hover:not(:disabled) {
    background: rgba(185, 188, 190, 0.1);
    color: #e0e7ef;
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    color: #444;
    cursor: not-allowed;
    transform: none;
}

/* GIF Button */
.gif-btn {
    background: none;
    border: none;
    margin-right: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: 8px;
    transition: background 0.2s;
}
.gif-btn:hover {
    background: #222;
}

/* GIF Picker Modal */
.gif-picker-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.gif-picker-content {
    background: #0f0f0f;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.gif-search-input {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: #0f0f0f;
    color: #e0e7ef;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.gif-search-input:focus {
    border-color: rgba(255,255,255,0.5);
}
.gif-results {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    overflow-y: auto;
    max-height: 300px;
    min-height: 120px;
    justify-content: flex-start;
}
.gif-results img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s;
}
.gif-results img:hover {
    border: 2px solid #007acc;
}
.close-gif-picker {
    align-self: flex-end;
    background: #0f0f0f;
    color: #e0e7ef;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}
.close-gif-picker:hover {
    background: #151515;
    border-color: rgba(255,255,255,0.5);
}

/* Plus Popup */
.plus-popup {
    position: absolute;
    bottom: 100%;
    left: 0.5rem;
    margin-bottom: 0.5rem;
    background: #0f0f0f;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 1000;
    min-width: 150px;
}
.plus-popup[style*="block"] {
    background: #0f0f0f !important;
    border-color: #333 !important;
}
.plus-popup-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 120px;
}
.plus-option-btn {
    background: none;
    border: none;
    color: #e0e7ef;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: background 0.2s;
    text-align: left;
}
.plus-option-btn:hover {
    background: #222;
}
.plus-option-btn svg {
    flex-shrink: 0;
}

/* Position the input container relatively so popup can position above it */
.input-container {
    position: relative;
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox Scrollbar */
.messages-container {
    scrollbar-width: thin;
    scrollbar-color: #444 #2a2a2a;
}

/* Admin Badge Styling */
.admin-badge {
    color: #007acc !important;
    font-weight: bold;
    font-size: 0.7rem;
    background: rgba(0, 122, 204, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    margin-left: 0.3rem;
}

/* Loading States */
.loading-messages {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #888;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top: 2px solid #007acc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* Animations */
@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Error States */
.error-message {
    text-align: center;
    color: #f44336;
    padding: 2rem;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 8px;
    margin: 1rem;
}

.warning-message {
    text-align: center;
    color: #ff9800;
    padding: 1rem;
    background: rgba(255, 152, 0, 0.1);
    border-radius: 8px;
    margin: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        margin: 1rem;
        height: calc(100vh - 100px);
        border-radius: 8px;
    }

    .messages-container {
        padding: 1rem;
        gap: 0.75rem;
    }

    .input-container {
        padding: 1rem;
        gap: 0.75rem;
    }

    .message {
        max-width: 85%;
    }

    .message-content {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .send-btn {
        position: relative;
        right: auto;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        width: auto;
        height: auto;
    }

    .chat-header {
        padding: 0.75rem 1rem;
    }

    .chat-header h2 {
        font-size: 1.2rem;
    }

    .chat-layout {
        flex-direction: column;
        gap: 1rem;
    }
    
    .sidebar-panel {
        width: 100%;
        height: auto;
        order: 2;
    }
    
    .chat-container {
        order: 1;
    }
}

@media (max-width: 480px) {
    .chat-container {
        margin: 0.5rem;
        height: calc(100vh - 80px);
    }

    .messages-container {
        padding: 0.75rem;
    }

    .input-container {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .message-input {
        order: 1;
        max-height: 80px;
        padding: 0.75rem 1rem; /* Reset padding on mobile */
    }

    .send-btn {
        order: 2;
        width: 100%;
        padding: 0.75rem;
        position: relative;
        right: auto;
        height: auto;
    }

    .message {
        max-width: 95%;
    }

    .sidebar-panel {
        padding: 0.75rem;
    }
    
    .chat-layout {
        margin: 1rem 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-container {
        border: 3px solid #fff;
    }

    .message-content {
        border: 2px solid #fff;
    }

    .message-input {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .message {
        animation: none;
    }

    .send-btn {
        transition: none;
    }

    .message-input {
        transition: none;
    }

    .messages-container {
        scroll-behavior: auto;
    }
}

/* Message Reactions */
.message-reactions {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.message-reactions button {
    background: #2f3136;
    border: 1px solid #40444b;
    color: #b9bbbe;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: all 0.15s ease;
}

.message-reactions button:hover {
    background: #40444b;
}

.message-reactions button.user-reacted {
    background: #5865f2;
    border-color: #5865f2;
    color: #ffffff;
}

.message-reactions button.user-reacted:hover {
    background: #4752c4;
}

/* Sidebar Content */
.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section-header {
    color: #8e9297;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.channel-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: #96989d;
    font-weight: 500;
}

.channel-item:hover {
    background-color: #35393f;
    color: #dcddde;
}

.channel-item.active {
    background-color: #404249;
    color: #ffffff;
}

.channel-hash {
    margin-right: 0.375rem;
    font-size: 1.25rem;
    font-weight: 300;
    color: #8e9297;
}

.channel-item.active .channel-hash {
    color: #ffffff;
}

.channel-name {
    font-size: 0.9rem;
}
