/**
 * Public Chat Styles
 * Matches Inriz site design language
 */



:root {
    /* Theme variables - Light (default) */
    --chat-bg: #ffffff;
    --chat-bg-secondary: #f8f9fa;
    --chat-bg-tertiary: #f0f2f5;
    --chat-border: #e5e7eb;
    --chat-text: #1a1a1a;
    --chat-text-secondary: #6b7280;
    --chat-text-muted: #9ca3af;
    --chat-accent: #0595ff;
    --chat-accent-hover: #007ad1;
    --chat-accent-light: #e5f3ff;
    --chat-error: #dc2626;
    --chat-success: #16a34a;
    --chat-warning: #d97706;
    --chat-admin-color: #dc2626;
    --chat-user-color: #0595ff;
    --chat-guest-color: #6b7280;
    --chat-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --chat-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --chat-radius: 24px;
    --chat-radius-sm: 4px;
}

/* Dark theme */
.theme-dark {
    --chat-bg: #1a1a2e;
    --chat-bg-secondary: #16213e;
    --chat-bg-tertiary: #1f2f5a;
    --chat-border: #2a2a4a;
    --chat-text: #e0e0e0;
    --chat-text-secondary: #a0a0b0;
    --chat-text-muted: #6a6a7a;
    --chat-accent: #0595ff;
    --chat-accent-hover: #3ab0ff;
    --chat-accent-light: #1a3a5c;
    --chat-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --chat-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--chat-bg);
    color: var(--chat-text);
    height: 100vh;
    overflow: hidden;
}

#chat-container {
    height: 100vh;
    width: 100%;
}

/* Layout */
.chat-layout {
    display: flex;
    height: 100%;
}

/* Sidebar */
.chat-sidebar {
    width: 260px;
    background: var(--chat-bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--chat-border);
}

.sidebar-header {
    padding: 16px 20px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--chat-text-muted);
    letter-spacing: 0.5px;
}

/* Channel List */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 2px;
    border-radius: var(--chat-radius);
    cursor: pointer;
    transition: background 0.15s ease;
    color: var(--chat-text-secondary);
}

.channel-item:hover {
    background: var(--chat-bg-tertiary);
    color: var(--chat-text);
}

.channel-item.active {
    background: var(--chat-accent-light);
    color: var(--chat-accent);
}

.channel-icon {
    margin-right: 10px;
    font-size: 15px;
    opacity: 0.6;
    font-style: normal;
}

.channel-name-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.unread-badge {
    background: var(--chat-accent);
    color: white;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* Online List */
.online-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 0 12px 12px;
}

.online-user {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--chat-radius-sm);
}

.online-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-success);
    margin-right: 10px;
    flex-shrink: 0;
}

.online-user.role-admin .online-name {
    color: var(--chat-admin-color);
    font-weight: 600;
}

.online-user.role-user .online-name {
    color: var(--chat-user-color);
    font-weight: 500;
}

.online-user.role-guest .online-name {
    color: var(--chat-guest-color);
    font-style: italic;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--chat-bg);
}

/* Chat Header */
.chat-header {
    height: 60px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--chat-bg);
    border-bottom: 1px solid var(--chat-border);
}

.channel-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--chat-text);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.status-connecting { background: var(--chat-warning); }
.status-connected { background: var(--chat-success); }
.status-disconnected { background: var(--chat-text-muted); }
.status-error { background: var(--chat-error); }
.status-failed { background: var(--chat-error); }

.username-display {
    font-size: 13px;
    color: var(--chat-text-secondary);
    font-weight: 500;
}

/* Messages Container */
.message-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Message */
.message {
    padding: 10px 14px;
    border-radius: var(--chat-radius);
    position: relative;
    max-width: 100%;
    transition: background 0.15s ease;
}

.message:hover {
    background: var(--chat-bg-secondary);
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 600;
    font-size: 14px;
}

.message.role-admin .message-author {
    color: var(--chat-admin-color);
}

.message.role-user .message-author {
    color: var(--chat-user-color);
}

.message.role-guest .message-author {
    color: var(--chat-guest-color);
}

.guest-name {
    font-style: italic;
    font-weight: 500;
}

.message-time {
    font-size: 11px;
    color: var(--chat-text-muted);
}

.message-content {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    color: var(--chat-text);
}

.message-content.deleted {
    color: var(--chat-text-muted);
    font-style: italic;
}

.edited-indicator {
    font-size: 11px;
    color: var(--chat-text-muted);
    font-style: italic;
    margin-left: 4px;
}

/* Grouped messages (consecutive from same sender) */
.message-grouped {
    padding-top: 2px;
}

.message-grouped .message-header {
    display: none;
}

/* Message Actions */
.message-actions {
    position: absolute;
    right: 10px;
    top: 10px;
    display: none;
    gap: 6px;
    background: var(--chat-bg);
    padding: 4px;
    border-radius: var(--chat-radius-sm);
    box-shadow: var(--chat-shadow);
}

.message:hover .message-actions {
    display: flex;
}

.action-btn {
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    font-family: inherit;
}

.action-edit {
    background: var(--chat-bg-tertiary);
    color: var(--chat-text-secondary);
}

.action-edit:hover {
    background: var(--chat-accent-light);
    color: var(--chat-accent);
}

.action-delete {
    background: var(--chat-bg-tertiary);
    color: var(--chat-text-secondary);
}

.action-delete:hover {
    background: #fef2f2;
    color: var(--chat-error);
}

/* Input Area */
.input-area {
    padding: 16px 24px 20px;
    display: flex;
    gap: 12px;
    background: var(--chat-bg);
    border-top: 1px solid var(--chat-border);
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius);
    background: var(--chat-bg);
    color: var(--chat-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.message-input:focus {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px var(--chat-accent-light);
}

.message-input::placeholder {
    color: var(--chat-text-muted);
}

.send-button {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    background: var(--chat-accent);
    color: white;
    border: none;
    border-radius: var(--chat-radius);
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.send-button:hover {
    background: var(--chat-accent-hover);
}

.send-button.disabled {
    background: var(--chat-text-muted);
    cursor: not-allowed;
}

/* Edit Overlay */
.edit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.edit-overlay.visible {
    display: flex;
}

.edit-modal {
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius);
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--chat-shadow-lg);
}

.edit-header {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--chat-text);
}

.edit-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius);
    background: var(--chat-bg);
    color: var(--chat-text);
    margin-bottom: 20px;
    outline: none;
    font-family: inherit;
}

.edit-input:focus {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px var(--chat-accent-light);
}

.edit-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-cancel {
    padding: 10px 20px;
    font-size: 14px;
    background: var(--chat-bg-tertiary);
    color: var(--chat-text-secondary);
    border: none;
    border-radius: var(--chat-radius);
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s ease;
}

.btn-cancel:hover {
    background: var(--chat-border);
}

.btn-save {
    padding: 10px 20px;
    font-size: 14px;
    background: var(--chat-accent);
    color: white;
    border: none;
    border-radius: var(--chat-radius);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s ease;
}

.btn-save:hover {
    background: var(--chat-accent-hover);
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: var(--chat-radius);
    font-size: 14px;
    z-index: 1001;
    animation: slideIn 0.3s ease;
    box-shadow: var(--chat-shadow-lg);
    font-weight: 500;
}

.notification-info {
    background: var(--chat-accent);
    color: white;
}

.notification-warning {
    background: var(--chat-warning);
    color: white;
}

.notification-error {
    background: var(--chat-error);
    color: white;
}

.notification-invite {
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.invite-buttons {
    display: flex;
    gap: 8px;
}

.invite-buttons button {
    padding: 7px 14px;
    font-size: 12px;
    border: none;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
}

.invite-buttons button:first-child {
    background: var(--chat-success);
    color: white;
}

.invite-buttons button:last-child {
    background: var(--chat-bg-tertiary);
    color: var(--chat-text-secondary);
}

/* Banned Overlay */
.banned-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
}

.banned-content {
    text-align: center;
    padding: 40px;
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    max-width: 400px;
}

.banned-content h2 {
    color: var(--chat-error);
    margin: 0 0 16px 0;
    font-size: 20px;
}

.banned-content p {
    color: var(--chat-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--chat-text-muted);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: var(--chat-shadow-lg);
    }

    .chat-sidebar.open {
        left: 0;
    }

    .chat-header {
        padding-left: 60px;
    }

    .message-actions {
        display: flex;
        position: static;
        margin-top: 8px;
        background: none;
        box-shadow: none;
        padding: 0;
    }

    .input-area {
        padding: 12px 16px 16px;
    }

    .message-container {
        padding: 16px;
    }
}
