/* ========================================
   Public Chat Styles
   ======================================== */

.chat-online-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
}

.chat-online-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

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

/* Messages Area */
.chat-messages {
    height: 450px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}

/* Yellow Square Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-1);
    border-radius: 0;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #fbbf24;
    border-radius: 0;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #f59e0b;
}

.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #fbbf24 var(--bg-1);
}

/* Click-to-reveal UniqueID for Admin */
.chat-uid-toggle {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    cursor: pointer;
    user-select: none;
}

.chat-uid-icon {
    font-size: 12px;
    color: var(--text-3);
    padding: 2px 6px;
    background: var(--bg-2);
    border-radius: 4px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.chat-uid-toggle:hover .chat-uid-icon {
    border-color: #10b981;
    color: #10b981;
}

.chat-uid-value {
    display: none;
    font-size: 10px;
    font-family: monospace;
    color: #10b981;
    padding: 2px 6px;
    background: var(--bg-1);
    border-radius: 4px;
    border: 1px solid #10b981;
    white-space: nowrap;
}

.chat-uid-toggle.open .chat-uid-icon {
    display: none;
}

.chat-uid-toggle.open .chat-uid-value {
    display: inline-block;
}

.chat-msg {
    padding: 4px 0;
    background: transparent;
    border: none;
    border-radius: 0;
    max-width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}

.chat-msg:hover {
    background: var(--bg-1);
}

.chat-msg-own {
    background: transparent;
}

.chat-msg-system {
    align-self: center;
    max-width: 100%;
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-2);
}

.chat-msg-system .chat-msg-icon {
    font-size: 14px;
}

.chat-msg-system .chat-msg-text {
    flex: 1;
}

.chat-msg-system .chat-msg-time {
    color: var(--text-3);
    font-size: 11px;
}

.chat-msg-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chat-msg-name {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.chat-msg-name:hover {
    text-decoration: underline;
}

.chat-msg-name::after {
    content: ':';
}

.chat-mention {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.chat-msg-admin-info {
    font-size: 10px;
    color: var(--text-3);
    font-family: monospace;
}

.chat-msg-time {
    font-size: 11px;
    color: var(--text-3);
    margin-left: 8px;
    flex-shrink: 0;
}

.chat-msg-actions {
    display: none;
    gap: 4px;
    margin-left: 8px;
}

.chat-msg:hover .chat-msg-actions {
    display: flex;
}

.chat-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-1);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: var(--bg-3);
}

.chat-block-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.chat-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.chat-mute-btn:hover {
    background: rgba(251, 191, 36, 0.2);
}

.chat-ban-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

.chat-msg-body {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
    word-break: break-word;
    display: inline;
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
}

.chat-form {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.chat-form .auth-input {
    flex: 1;
    margin: 0;
    height: 44px;
}

.chat-send-btn {
    padding: 0 24px;
    height: 44px;
    background: var(--gold);
    border: 1px solid var(--gold);
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-send-btn:hover {
    background: var(--gold-dim);
    border-color: var(--gold-dim);
}

.chat-input-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-3);
}

.chat-clear-all-btn {
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Sidebar */
.chat-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-rules {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.chat-rules-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.chat-rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
}

.chat-rules-list li {
    padding: 6px 0;
    padding-left: 16px;
    position: relative;
}

.chat-rules-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #10b981;
}

.chat-blocked {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.chat-blocked-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.chat-unblock-all-btn {
    width: 100%;
    padding: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-unblock-all-btn:hover {
    background: var(--bg-3);
    color: var(--text);
}

/* Restricted Page */
.chat-restricted-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 20px;
}

.chat-restricted-box {
    max-width: 500px;
    text-align: center;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
}

.chat-restricted-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.chat-restricted-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.chat-restricted-text {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 24px;
}

.chat-restricted-requirements {
    background: var(--bg-2);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.chat-restricted-req-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.chat-restricted-req-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
}

.chat-restricted-req-list li {
    padding: 6px 0;
}

.chat-restricted-both {
    margin: 12px 0 8px 0;
    padding: 8px 12px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    font-size: 13px;
}

.chat-restricted-warning {
    margin-top: 16px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 13px;
}

.chat-restricted-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.chat-restricted-actions .btn {
    padding: 10px 20px;
}

/* Light Theme */
body.light-theme .chat-container {
    background: #fff;
}

body.light-theme .chat-header {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.03) 100%);
}

body.light-theme .chat-msg {
    background: #f8fafc;
}

body.light-theme .chat-msg:hover {
    background: #f1f5f9;
}

body.light-theme .chat-msg-own {
    background: rgba(16, 185, 129, 0.08);
}

body.light-theme .chat-msg-system {
    background: rgba(251, 191, 36, 0.08);
}

body.light-theme .chat-input-area {
    background: #f8fafc;
}

body.light-theme .chat-input {
    background: #fff;
}

body.light-theme .chat-action-btn {
    background: #fff;
}

body.light-theme .chat-rules,
body.light-theme .chat-blocked,
body.light-theme .chat-restricted-box {
    background: #fff;
}

body.light-theme .chat-restricted-requirements {
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 900px) {
    .chat-page {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .chat-container {
        height: calc(100vh - 180px);
    }
}

@media (max-width: 600px) {
    .chat-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .chat-header-right {
        flex-direction: column;
        gap: 8px;
    }
    
    .chat-form {
        flex-direction: column;
    }
    
    .chat-send-btn {
        width: 100%;
    }
    
    .chat-msg {
        max-width: 95%;
    }
    
    .chat-msg-actions {
        display: flex;
        margin-top: 8px;
        margin-left: 0;
    }
    
    .chat-restricted-actions {
        flex-direction: column;
    }
}
