* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #EDEDED;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
}
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }
}
.login-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.chat-container {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
}
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ebebeb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #181818;
    color: white;
}
.chat-title {
    font-weight: 600;
    font-size: 18px;
}
.online-users-toggle, .share-button {
    background: none;
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
}
.online-users-toggle:hover, .share-button:hover {
    background: rgba(255, 255, 255, 0.1);
}
.back-arrow {
    font-size: 22px;
    cursor: pointer;
    display: none;
}
@media (max-width: 768px) {
    .back-arrow {
        display: block;
    }
}
.chat-body {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}
.message-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #EDEDED;
}
.message {
    margin: 12px 0;
    padding: 15px;
    border-radius: 16px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.message.sent {
    background: #07c160;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.message.received {
    background: #ffffff;
    color: black;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}
.message .avatar-container {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
}
.message .nickname {
    font-size: 14px;
    opacity: 0.8;
    margin-right: 10px;
}
.message .content {
    white-space: pre-wrap;
    word-break: break-word;
}
.message .time {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 8px;
    text-align: right;
}
.message .image-content {
    max-width: 100%;
    margin-top: 12px;
    border-radius: 8px;
    cursor: pointer;
}
.system-message {
    text-align: center;
    color: #666;
    margin: 12px 0;
    font-size: 14px;
}
.typing-indicator {
    text-align: center;
    color: #666;
    margin: 12px 0;
    font-size: 14px;
    font-style: italic;
}
.online-users-panel {
    width: 250px;
    background: #f9f9f9;
    border-left: 1px solid #eee;
    padding: 20px;
    overflow-y: auto;
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    z-index: 10;
}
@media (min-width: 768px) {
    .online-users-panel {
        position: relative;
        height: auto;
        width: 300px;
        box-shadow: -2px 0 12px rgba(0,0,0,0.1);
    }
}
.online-users-header {
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.close-panel {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    display: none;
}
@media (max-width: 768px) {
    .close-panel {
        display: block;
    }
}
.online-user {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #28a745;
}
.avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
}
.input-container {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    background: white;
    position: relative;
    align-items: flex-end;
    min-height: 70px;
}
.input-left {
    flex: 1;
    display: flex;
    align-items: flex-end;
}
.input-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}
textarea {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    flex: 1;
    font-size: 16px;
    resize: none;
    max-height: 150px;
    min-height: 50px;
    font-family: inherit;
    transition: max-height 0.2s ease;
}
input[type="text"], input[type="password"] {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    flex: 1;
    font-size: 16px;
}
input:focus, textarea:focus {
    outline: none;
    border-color: #07c160;
}
button {
    padding: 15px 30px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s;
    white-space: nowrap;
    min-width: 100px;
}
button:hover {
    background: #06ae56;
}
button:active {
    transform: scale(0.98);
}
.status {
    text-align: center;
    color: #666;
    margin: 12px 0;
    padding: 10px;
    font-size: 14px;
}
.input-group {
    margin-bottom: 20px;
}
.input-label {
    display: block;
    margin-bottom: 10px;
    color: #666;
    font-size: 16px;
}
.send-help {
    font-size: 12px;
    color: #666;
    text-align: right;
    padding-top: 6px;
    display: none;
}
@media (min-width: 768px) {
    .send-help {
        display: block;
    }
}
.image-upload-container {
    margin-right: 12px;
    display: flex;
    align-items: center;
}
.image-upload-button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 15px;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.image-upload-button:hover {
    background: #f5f5f5;
}
.image-preview-container {
    margin-top: 12px;
    position: relative;
    display: none;
}
.image-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #ddd;
}
.remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f44336;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.webp-option-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.webp-label {
    font-size: 14px;
    color: #666;
    margin: 0;
    padding: 0;
}
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}
.draggable {
    max-width: 80%;
    max-height: 80vh;
    object-fit: contain;
    cursor: move;
    position: absolute;
    transform-origin: center center;
}
.image-viewer .draggable {
    transform: translate(-50%, -50%) scale(1);
}
.viewer-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    padding: 10px 20px;
    border-radius: 5px;
    display: none;
    gap: 15px;
}
.image-viewer:hover .viewer-controls {
    display: flex;
}
.viewer-controls button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #fff;
    font-size: 0;
}
.viewer-controls button:hover {
    color: #07c160;
}
.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
}
.upload-progress {
    height: 6px;
    width: 100%;
    background-color: #f0f0f0;
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
    display: none;
}
.upload-progress-bar {
    height: 100%;
    width: 0;
    background-color: #4CAF50;
    transition: width 0.2s;
}
.upload-status {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
    display: none;
}
button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}
.file-input {
    display: none;
}
@media (max-width: 768px) {
    .image-viewer {
        padding-top: 0;
    }
    .draggable {
        max-width: 90%;
        max-height: 70vh;
    }
    .viewer-controls {
        padding: 8px 15px;
        gap: 10px;
    }
    .input-container {
        padding: 15px;
        flex-direction: column;
    }
    .input-left {
        flex-direction: row;
        align-items: flex-end;
        width: 100%;
    }
    textarea {
        flex: 1;
        margin-right: 12px;
    }
    .image-upload-container {
        margin-top: 0;
    }
    .input-right {
        flex-direction: row;
        justify-content: flex-end;
        margin-top: 12px;
    }
    button#send {
        margin-right: 12px;
    }
    .webp-option-container {
        top: 15px;
        right: 15px;
    }
    .send-help {
        display: none;
    }
}
@media (min-width: 769px) {
    .input-container {
        flex-direction: row;
    }
    .input-left {
        flex: 1;
        flex-direction: row;
        align-items: flex-end;
    }
    textarea {
        flex: 1;
        margin-right: 12px;
    }
    .image-upload-container {
        margin-left: 0;
    }
    .input-right {
        flex: 0 0 auto;
        flex-direction: column;
        align-items: flex-end;
    }
    button#send {
        margin-bottom: 8px;
    }
}