/* SV Loot Live Chat Styles */
/* Consistent with website's black/white theme and glassmorphism */

:root {
    --soft-white: #f2f2f2;
    --soft-black: #121314;
    --chat-width: 350px;
    --chat-border-radius: 12px;
    --transition: all 0.3s ease;
    --glass-bg: rgba(242, 242, 242, 0.95);
    --glass-border: rgba(18, 19, 20, 0.1);
    --shadow: 0 8px 32px rgba(18, 19, 20, 0.1);
}

/* Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--soft-black);
    color: var(--soft-white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    background: #2a2b2c;
}

.chat-toggle-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Chat Sidebar */
.chat-sidebar {
    position: fixed;
    top: 80px; /* Below navbar */
    right: 0; /* Always positioned on right */
    width: var(--chat-width);
    height: calc(100vh - 80px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--chat-border-radius) 0 0 var(--chat-border-radius);
    box-shadow: var(--shadow);
    z-index: 9999;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%); /* Hidden by default */
    /* Prevent affecting page layout */
    pointer-events: none;
}

.chat-sidebar.open {
    transform: translateX(0); /* Show when open */
    pointer-events: auto;
}

/* Ensure chat doesn't affect main content layout */
body.chat-open {
    /* Don't change any layout properties */
    overflow-x: hidden !important;
}

/* Prevent main content from being affected by chat */
body.chat-open .container,
body.chat-open main,
body.chat-open .page-content {
    transform: none !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: none !important;
    transition: none !important;
}

/* Chat Header */
.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(18, 19, 20, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--soft-black);
}

.chat-title i {
    color: var(--soft-black);
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.online-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.close-chat-btn {
    background: none;
    border: none;
    color: var(--soft-black);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.close-chat-btn:hover {
    background: rgba(18, 19, 20, 0.1);
}

/* Chat Messages Container */
.chat-messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(18, 19, 20, 0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(18, 19, 20, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(18, 19, 20, 0.3);
}

/* Message Styles */
.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(18, 19, 20, 0.08);
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

/* Removed hover effects for cleaner appearance */

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.message-username {
    font-weight: 600;
    color: var(--soft-black);
}

.message-username.moderator {
    color: #ffc107;
}

.message-username.moderator::after {
    content: " 👑";
    font-size: 0.7rem;
}

.message-time {
    color: #666;
    font-size: 0.75rem;
    margin-left: auto;
}

.message-content {
    color: var(--soft-black);
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
}

/* System Messages */
.message-system {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
    font-style: italic;
}

.message-system .message-username {
    color: #28a745;
    font-weight: bold;
}

.message-system .message-content {
    color: #155724;
}

/* Chat Giveaway Display - Pinned at top */
.chat-giveaway-banner {
    background: linear-gradient(135deg, rgba(18, 19, 20, 0.95), rgba(18, 19, 20, 0.85));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(242, 242, 242, 0.1);
    border-radius: var(--chat-border-radius);
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    color: var(--soft-white);
    overflow: hidden;
}

.giveaway-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(242, 242, 242, 0.1);
}

.giveaway-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.giveaway-prize {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--soft-white);
}

.giveaway-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(242, 242, 242, 0.05);
}

.giveaway-timer, .giveaway-participants {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: rgba(242, 242, 242, 0.8);
}

.giveaway-timer i, .giveaway-participants i {
    font-size: 1rem;
}

.giveaway-actions {
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.giveaway-join-btn {
    background: var(--soft-white);
    color: var(--soft-black);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.giveaway-join-btn:hover {
    background: rgba(242, 242, 242, 0.9);
    transform: translateY(-1px);
}

.giveaway-join-btn:disabled {
    background: rgba(242, 242, 242, 0.3);
    color: rgba(242, 242, 242, 0.6);
    cursor: not-allowed;
    transform: none;
}

.giveaway-join-btn.joined {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* Giveaway Moderator Controls */
.giveaway-mod-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: none;
    gap: 0.25rem;
}

.chat-giveaway-banner:hover .giveaway-mod-controls {
    display: flex;
}

.giveaway-mod-btn {
    background: rgba(242, 242, 242, 0.1);
    border: 1px solid rgba(242, 242, 242, 0.2);
    color: var(--soft-white);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.giveaway-mod-btn:hover {
    background: rgba(242, 242, 242, 0.2);
    transform: scale(1.05);
}

.giveaway-mod-btn.stop {
    color: #f44336;
}

.giveaway-mod-btn.settings {
    color: #2196F3;
}

/* Winner Announcement */
.giveaway-winner {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.1));
    border: 1px solid rgba(76, 175, 80, 0.3);
    text-align: center;
    padding: 1rem;
    color: #4CAF50;
    font-weight: 600;
    font-size: 1.1rem;
    position: relative;
}

.giveaway-winner i {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

.winner-removal-timer {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

/* Moderation Controls */
.message-moderation {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: none;
    gap: 0.25rem;
}

.chat-message:hover .message-moderation {
    display: flex;
}

.mod-btn {
    background: rgba(18, 19, 20, 0.1);
    border: none;
    color: var(--soft-black);
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.mod-btn:hover {
    background: rgba(18, 19, 20, 0.2);
}

.mod-btn.delete:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.mod-btn.timeout:hover {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

/* New Message Notification */
.new-message-notification {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--soft-white);
    color: var(--soft-black);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 10;
    transition: var(--transition);
}

.new-message-notification:hover {
    background: rgba(18, 19, 20, 0.05);
}

/* Chat Input Container */
.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(18, 19, 20, 0.02);
    flex-shrink: 0;
}

.typing-indicators {
    margin-bottom: 0.5rem;
    min-height: 1.2rem;
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#chatInput {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--soft-white);
    color: var(--soft-black);
    font-size: 0.9rem;
    transition: var(--transition);
}

#chatInput:focus {
    outline: none;
    border-color: var(--soft-black);
    box-shadow: 0 0 0 2px rgba(18, 19, 20, 0.1);
}

.send-message-btn {
    background: var(--soft-black);
    color: var(--soft-white);
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-message-btn:hover {
    background: #2a2b2c;
}

.send-message-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #666;
}

.moderator-badge {
    color: #ffc107;
    font-weight: 600;
}

/* Chat States */
.chat-login-prompt,
.chat-banned,
.chat-timeout {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-message,
.banned-message,
.timeout-message {
    text-align: center;
    color: var(--soft-black);
}

.login-message i,
.banned-message i,
.timeout-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #666;
}

.login-message h3,
.banned-message h3,
.timeout-message h3 {
    margin-bottom: 0.5rem;
    color: var(--soft-black);
}

.login-message p,
.banned-message p,
.timeout-message p {
    margin-bottom: 1rem;
    color: #666;
}

.timeout-reason {
    font-style: italic;
    color: #dc3545 !important;
}

.timeout-moderator {
    font-size: 0.85rem;
    color: #666 !important;
}

.chat-locked-notice {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    color: #856404;
    font-weight: 500;
}

.chat-locked-notice i {
    margin-right: 0.5rem;
}

/* Moderation Modal */
.moderation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    backdrop-filter: blur(5px);
}

/* Giveaway Management Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18, 19, 20, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--soft-white);
    border-radius: var(--chat-border-radius);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(18, 19, 20, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    position: relative;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    color: var(--soft-black);
    margin: 0;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--soft-black);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
}

.close-modal-btn:hover {
    background: rgba(18, 19, 20, 0.1);
}

.moderation-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mod-action-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mod-action-btn.delete-btn {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.mod-action-btn.delete-btn:hover {
    background: rgba(220, 53, 69, 0.2);
}

.mod-action-btn.timeout-btn {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.mod-action-btn.timeout-btn:hover {
    background: rgba(255, 193, 7, 0.2);
}

.timeout-options {
    margin-top: 1rem;
}

.timeout-options h4 {
    color: var(--soft-black);
    margin-bottom: 1rem;
}

.timeout-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.timeout-duration-btn {
    padding: 0.5rem;
    border: 1px solid var(--glass-border);
    background: var(--soft-white);
    color: var(--soft-black);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.timeout-duration-btn:hover {
    background: rgba(18, 19, 20, 0.05);
    border-color: var(--soft-black);
}

.timeout-duration-btn.selected {
    background: var(--soft-black);
    color: var(--soft-white);
    border-color: var(--soft-black);
}

.timeout-reason {
    margin-top: 1rem;
}

.timeout-reason label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--soft-black);
    font-weight: 500;
}

.timeout-reason input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    background: var(--soft-white);
    color: var(--soft-black);
    font-size: 0.9rem;
}

.timeout-reason input:focus {
    outline: none;
    border-color: var(--soft-black);
    box-shadow: 0 0 0 2px rgba(18, 19, 20, 0.1);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--soft-black);
    color: var(--soft-white);
}

.btn-primary:hover {
    background: #2a2b2c;
}

.btn-secondary {
    background: transparent;
    color: var(--soft-black);
    border: 1px solid var(--soft-black);
}

.btn-secondary:hover {
    background: var(--soft-black);
    color: var(--soft-white);
}



[data-theme="dark"] .giveaway-mod-btn {
    background: rgba(18, 19, 20, 0.1);
    border: 1px solid rgba(18, 19, 20, 0.2);
    color: var(--soft-black);
}

[data-theme="dark"] .giveaway-mod-btn:hover {
    background: rgba(18, 19, 20, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --chat-width: 100vw;
    }

    .chat-sidebar {
        transform: translateX(100%);
        border-radius: 0;
        top: 70px;
        height: calc(100vh - 70px);
    }

    .chat-toggle-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }

    .moderation-actions {
        flex-direction: column;
    }

    .timeout-buttons {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
        padding: 1.5rem;
    }

    .giveaway-actions {
        flex-direction: column !important;
    }

    .participants-container {
        max-height: 200px !important;
    }
}

/* Additional z-index fixes to ensure chat appears on top */
.chat-toggle-btn,
.chat-sidebar {
    z-index: 99999 !important;
}

/* Prevent chat from being covered by other elements */
body {
    position: relative;
}

/* Dashboard-specific chat fixes */
body.chat-open {
    overflow-x: hidden !important;
    position: relative !important;
}

/* Ensure chat sidebar doesn't interfere with dashboard layout */
.chat-sidebar {
    position: fixed !important;
    z-index: 99999 !important;
    top: 80px !important;
    right: 0 !important;
    width: var(--chat-width) !important;
    height: calc(100vh - 80px) !important;
}

/* Prevent layout shifts on dashboard when chat opens */
.chat-sidebar.open {
    transform: translateX(0) !important;
    position: fixed !important;
}

/* Force main content to stay in place */
body.chat-open .page-content,
body.chat-open main,
body.chat-open .modern-hero,
body.chat-open .hero-grid,
body.chat-open .container {
    transform: none !important;
    transition: none !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Additional mobile fixes for dashboard */
@media (max-width: 768px) {
    .chat-sidebar {
        top: 70px !important;
        height: calc(100vh - 70px) !important;
        width: 100vw !important;
    }

    body.chat-open .page-content,
    body.chat-open main {
        transform: none !important;
        width: 100% !important;
        overflow-x: hidden !important;
        left: 0 !important;
        right: 0 !important;
        position: relative !important;
    }
}
