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

:root {
    --primary-color: #003366;
    --secondary-color: #004080;
    --background-dark: #e0e0e0;
    --background-light: #f5f5f5;
    --text-primary: #000000;
    --text-secondary: #333333;
    --success-color: #006600;
    --danger-color: #990000;
    --warning-color: #cc6600;
    --message-bg: #ffffff;
    --message-own-bg: #e6f2ff;
    --border-color: #999999;
    --header-bg: #cccccc;
    --button-bg: #d4d0c8;
    --input-bg: #ffffff;
}

body {
    font-family: "MS Sans Serif", Geneva, sans-serif;
    font-size: 11px;
    background: #c0c0c0;
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Login Screen */
.login-container {
    background: var(--background-light);
    border: 2px solid #000000;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #808080;
    border-bottom-color: #808080;
    padding: 2rem;
    width: 420px;
    box-shadow: 1px 1px 0 #000000;
}

.login-container h1 {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary-color);
    background: var(--header-bg);
    border: 1px solid #808080;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    padding: 8px;
    letter-spacing: 1px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 11px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-form input {
    padding: 6px;
    border: 2px solid;
    border-top-color: #808080;
    border-left-color: #808080;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 11px;
    font-family: "MS Sans Serif", Geneva, sans-serif;
}

.login-form input:focus {
    outline: 1px dotted #000000;
}

.login-form button {
    padding: 6px 12px;
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #000000;
    border-bottom-color: #000000;
    background: var(--button-bg);
    color: #000000;
    font-size: 11px;
    font-family: "MS Sans Serif", Geneva, sans-serif;
    cursor: pointer;
    font-weight: normal;
}

.login-form button:hover {
    background: #e0ddd8;
}

.login-form button:active {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.encryption-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid #808080;
}

.encryption-info p {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 11px;
    font-weight: bold;
}

.encryption-info ul {
    list-style: none;
    padding-left: 1rem;
}

.encryption-info li {
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px 0;
}

.encryption-info li::before {
    content: "• ";
    color: var(--text-primary);
}

/* Chat Screen */
.chat-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--background-light);
    border: 2px solid #000000;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: linear-gradient(to right, #000080, #1084d0);
    border-bottom: 2px solid #000000;
}

.header-info h2 {
    font-size: 11px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 2px;
}

.header-info h2 span {
    color: #ffffff;
}

.encryption-status {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #ffffff;
    font-size: 11px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border: 1px solid #000000;
}

.leave-button {
    padding: 4px 8px;
    background: var(--button-bg);
    color: #000000;
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #000000;
    border-bottom-color: #000000;
    cursor: pointer;
    font-size: 11px;
    font-family: "MS Sans Serif", Geneva, sans-serif;
}

.leave-button:hover {
    background: #e0ddd8;
}

.leave-button:active {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.chat-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #ffffff;
}

.users-panel {
    width: 200px;
    background: var(--background-light);
    border-right: 2px solid #808080;
    padding: 8px;
    overflow-y: auto;
}

.users-panel h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: bold;
    text-decoration: underline;
}

#users-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-item {
    padding: 4px;
    background: #ffffff;
    border: 1px solid #c0c0c0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.user-item:hover {
    background: #e6f2ff;
    border-color: #000080;
}

.user-status {
    width: 8px;
    height: 8px;
    background: #00ff00;
    border: 1px solid #000000;
}

.your-info {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #808080;
}

.your-info p {
    color: var(--text-primary);
    font-size: 11px;
    margin-bottom: 4px;
}

.your-info strong {
    color: var(--primary-color);
}

.key-fingerprint {
    font-family: "Courier New", monospace;
    word-break: break-all;
}

.key-fingerprint span {
    color: #666666;
    font-size: 10px;
}

.messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #ffffff;
}

#messages-container {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #ffffff;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    background: var(--header-bg);
    border: 1px solid #808080;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    flex-shrink: 0;
}

.message-content {
    max-width: 70%;
}

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

.message-username {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 11px;
}

.message.own .message-username {
    color: var(--text-primary);
}

.message-time {
    color: #666666;
    font-size: 10px;
}

.message-bubble {
    padding: 6px 8px;
    background: var(--message-bg);
    border: 1px solid #c0c0c0;
    word-wrap: break-word;
    font-size: 11px;
}

.message.own .message-bubble {
    background: var(--message-own-bg);
    border-color: #0066cc;
}

.encryption-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--success-color);
    font-size: 10px;
    margin-left: 4px;
}

.system-message {
    text-align: center;
    padding: 4px;
    color: #666666;
    font-size: 10px;
    font-style: italic;
    border-top: 1px dotted #c0c0c0;
    border-bottom: 1px dotted #c0c0c0;
}

.typing-indicator {
    padding: 0 8px 4px;
    color: #666666;
    font-size: 10px;
    font-style: italic;
    min-height: 16px;
}

.chat-input-area {
    display: flex;
    padding: 8px;
    background: var(--background-light);
    border-top: 2px solid #808080;
    gap: 8px;
}

#message-input {
    flex: 1;
    padding: 4px 6px;
    background: var(--input-bg);
    border: 2px solid;
    border-top-color: #808080;
    border-left-color: #808080;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    color: var(--text-primary);
    font-size: 11px;
    font-family: "MS Sans Serif", Geneva, sans-serif;
}

#message-input:focus {
    outline: 1px dotted #000000;
}

#message-input:disabled {
    background: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

#send-btn {
    padding: 4px 12px;
    background: var(--button-bg);
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #000000;
    border-bottom-color: #000000;
    color: #000000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "MS Sans Serif", Geneva, sans-serif;
    font-size: 11px;
}

#send-btn:hover:not(:disabled) {
    background: #e0ddd8;
}

#send-btn:active:not(:disabled) {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

#send-btn:disabled {
    background: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

#send-btn svg {
    width: 16px;
    height: 16px;
}

.echat-text {
    padding-bottom: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #c0c0c0;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    border: 2px solid #000000;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay p {
    font-size: 11px;
    color: var(--text-primary);
}

.loader {
    width: 32px;
    height: 32px;
    border: 2px solid #808080;
    border-top: 2px solid #000080;
    animation: spin 1s linear infinite;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--background-light);
    padding: 16px;
    border: 2px solid #000000;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #808080;
    border-bottom-color: #808080;
    max-width: 360px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 8px;
    color: var(--danger-color);
    font-size: 11px;
    font-weight: bold;
    background: linear-gradient(to right, #000080, #1084d0);
    color: #ffffff;
    padding: 4px;
    margin: -16px -16px 8px -16px;
}

.modal-content p {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 11px;
}

.modal-content button {
    padding: 4px 16px;
    background: var(--button-bg);
    color: #000000;
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #000000;
    border-bottom-color: #000000;
    cursor: pointer;
    font-size: 11px;
    font-family: "MS Sans Serif", Geneva, sans-serif;
}

.modal-content button:hover {
    background: #e0ddd8;
}

.modal-content button:active {
    border-top-color: #000000;
    border-left-color: #000000;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

/* Animations */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

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

::-webkit-scrollbar-track {
    background: #c0c0c0;
    border-left: 1px solid #808080;
}

::-webkit-scrollbar-thumb {
    background: var(--button-bg);
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #000000;
    border-bottom-color: #000000;
}

::-webkit-scrollbar-thumb:hover {
    background: #e0ddd8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .users-panel {
        display: none;
    }

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

    .login-container {
        padding: 16px;
        width: 90%;
    }
}

