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

:root {
    --primary-color: #00d4ff;
    --primary-dark: #0099cc;
    --secondary-color: #ff006e;
    --accent-color: #00ff88;
    --bg-dark: #0a0e27;
    --bg-darker: #050812;
    --bg-card: #1a1f3a;
    --text-primary: #e0e0ff;
    --text-secondary: #9da5c7;
    --border-color: #2a2f4a;
    --neon-glow: 0 0 10px rgba(0, 212, 255, 0.3);
    --neon-glow-strong: 0 0 20px rgba(0, 212, 255, 0.6);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ============ LOGIN STYLES ============ */

.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: flex;
    width: 100%;
    height: 100vh;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-darker) 0%, #1a0f2e 50%, var(--bg-dark) 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: rgba(26, 31, 58, 0.8);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    box-shadow: 
        0 0 30px rgba(0, 212, 255, 0.3),
        inset 0 0 30px rgba(0, 212, 255, 0.05);
    backdrop-filter: blur(10px);
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
    text-shadow: var(--neon-glow-strong);
}

.logo h1 {
    font-size: 28px;
    color: var(--primary-color);
    text-shadow: var(--neon-glow-strong);
    letter-spacing: 2px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(10, 14, 39, 0.5);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--neon-glow);
    background: rgba(10, 14, 39, 0.8);
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    color: var(--bg-darker);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--neon-glow-strong);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.8);
}

.btn-login:active {
    transform: translateY(0);
}

.register-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.register-link a {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.register-link a:hover {
    color: var(--accent-color);
    text-shadow: var(--neon-glow);
}

.demo-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ============ CHAT STYLES ============ */

.chat-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background: linear-gradient(to right, var(--bg-darker) 0%, var(--bg-dark) 100%);
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-darker) 100%);
    border-right: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: inset -10px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 24px;
    color: var(--primary-color);
    text-shadow: var(--neon-glow);
}

.search-box {
    padding: 15px;
    display: flex;
    align-items: center;
    background: rgba(10, 14, 39, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 15px;
    gap: 10px;
}

.search-box i {
    color: var(--text-secondary);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box input:focus {
    outline: none;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(26, 31, 58, 0.4);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.chat-item:hover {
    background: rgba(26, 31, 58, 0.8);
    border-color: var(--primary-color);
}

.chat-item.active {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: var(--neon-glow);
}

.chat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--bg-darker);
    flex-shrink: 0;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chat-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0;
    max-width: 120px;
    min-width: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--bg-darker);
    flex-shrink: 0;
}

.user-details p {
    margin: 2px 0;
}

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

.user-status {
    font-size: 12px;
    color: var(--accent-color);
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    position: relative;
    height: 100vh;
    overflow: hidden;
}

.welcome-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.welcome-content {
    text-align: center;
}

.welcome-content i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 20px;
    opacity: 0.5;
    text-shadow: var(--neon-glow);
}

.welcome-content h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

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

.btn-primary {
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    color: var(--bg-darker);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--neon-glow-strong);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.8);
}

.chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.chat-view.hidden {
    display: none;
}

.chat-header {
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(0, 14, 39, 0.6) 0%, rgba(26, 31, 58, 0.4) 100%);
    box-shadow: 0 2px 15px rgba(0, 212, 255, 0.1);
    min-height: 70px;
}

.chat-header-left h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 5px;
    text-shadow: var(--neon-glow);
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}

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

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    height: 100%;
    justify-content: flex-start;
    align-items: stretch;
    background: linear-gradient(to bottom, rgba(10, 14, 39, 0.3), rgba(10, 14, 39, 0.1));
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
    max-width: 80%;
    word-wrap: break-word;
    margin-bottom: 8px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    flex-direction: row-reverse;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
}

.message:not(.own) {
    align-self: flex-start;
    margin-right: auto;
    margin-left: 0;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--bg-darker);
    flex-shrink: 0;
    font-size: 14px;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.message.own .message-avatar {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.message.own .message-content {
    align-items: flex-end;
}

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

.message.own .message-author {
    display: none;
}

.message-bubble {
    max-width: 500px;
    padding: 12px 16px;
    background: rgba(26, 31, 58, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 16px;
    color: var(--text-primary);
    word-wrap: break-word;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.message.own .message-bubble {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25) 0%, rgba(0, 212, 255, 0.15) 100%);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.message-bubble:hover {
    border-color: var(--primary-color);
    background: rgba(26, 31, 58, 0.95);
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.message-input-area {
    padding: 15px 20px;
    border-top: 2px solid var(--border-color);
    background: rgba(26, 31, 58, 0.5);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
    min-height: 70px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.input-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(26, 31, 58, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.btn-icon:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: var(--neon-glow);
}

.message-form {
    flex: 1;
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-form input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(10, 14, 39, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.message-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
    background: rgba(10, 14, 39, 0.8);
}

.message-form input::placeholder {
    color: var(--text-secondary);
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: var(--bg-darker);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

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

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

/* ============ MODAL STYLES ============ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.4);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
}

.modal.active {
    display: block;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -55%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

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

.modal-header h2 {
    color: var(--primary-color);
    text-shadow: var(--neon-glow);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
}

.btn-close:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(26, 31, 58, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ============ SCROLLBAR STYLES ============ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    box-shadow: var(--neon-glow);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
    .sidebar {
        width: 250px;
    }

    .message-bubble {
        max-width: 80%;
    }

    .login-box {
        margin: 20px;
    }
}

@media (max-width: 600px) {
    .chat-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
        max-height: 200px;
        flex-direction: row;
    }

    .chats-list {
        display: none;
    }

    .chat-main {
        height: calc(100vh - 200px);
    }

    .message-bubble {
        max-width: 85%;
    }

    .modal {
        width: 95%;
        max-width: 100%;
    }
}
