/* Chat Dashboard Styles */

:root {
    --primary-color: #611f69;
    --secondary-color: #1264a3;
    --success-color: #2d9f5d;
    --danger-color: #e01e5a;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f8f8;
    --bg-dark: #3f0e40;
    --text-primary: #1d1c1d;
    --text-secondary: #616061;
    --border-color: #e0e0e0;
    --sidebar-width: 260px;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* Login & Register Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 32px;
}

.auth-box p {
    margin-bottom: 30px;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: #4a1754;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #fdecea;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.alert-success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-section {
    padding: 20px 0;
}

.sidebar-section-title {
    padding: 0 20px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.channel-list, .user-list {
    list-style: none;
}

.channel-item, .user-item {
    padding: 8px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
}

.channel-item:hover, .user-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.channel-item.active {
    background-color: var(--secondary-color);
}

.channel-item::before {
    content: '#';
    margin-right: 8px;
    font-weight: 600;
}

.user-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}

.user-status.online {
    background-color: var(--success-color);
}

.user-status.offline {
    background-color: var(--text-secondary);
}

.add-channel-btn {
    padding: 8px 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: color 0.2s;
}

.add-channel-btn:hover {
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
}

/* Header */
.chat-header {
    height: var(--header-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
}

.chat-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: var(--bg-secondary);
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    gap: 12px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 700;
    color: var(--text-primary);
}

.message-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-text {
    color: var(--text-primary);
    word-wrap: break-word;
}

.message-files {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-attachment {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    max-width: 300px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-attachment:hover {
    background-color: var(--bg-secondary);
}

.file-attachment img {
    max-width: 100%;
    border-radius: 4px;
    margin-bottom: 5px;
}

.file-attachment video {
    max-width: 100%;
    border-radius: 4px;
    margin-bottom: 5px;
}

.file-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.file-type {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Message Input */
.message-input-container {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

.message-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 150px;
}

.message-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.btn-send, .btn-upload {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-send {
    background-color: var(--success-color);
    color: white;
}

.btn-send:hover {
    background-color: #267a4a;
}

.btn-upload {
    background-color: var(--secondary-color);
    color: white;
}

.btn-upload:hover {
    background-color: #0e4c7a;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 2001;
    line-height: 1;
    padding: 0;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 2001;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    max-width: 80%;
    text-align: center;
}

/* Update file attachment cursor */
.file-attachment.has-preview {
    cursor: zoom-in;
}

.file-attachment.has-preview:hover {
    opacity: 0.9;
}
