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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f0f0;
    height: 100vh;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
    z-index: 100;
}

.header-left,
.header-right {
    width: 40px;
    display: flex;
    align-items: center;
}

.header-center {
    flex: 1;
    text-align: center;
}

.refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.refresh-btn:active svg {
    animation: rotate 0.6s ease;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.contact-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    position: relative;
}

.more-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 8px;
    background-color: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4cfc9' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.2s ease;
}

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

.system-warning {
    text-align: center;
    margin: 16px 0;
}

.system-warning p {
    display: inline-block;
    padding: 8px 16px;
    background-color: rgba(0, 0, 0, 0.05);
    color: #999;
    font-size: 12px;
    border-radius: 16px;
    margin: 0;
}

.message.left {
    justify-content: flex-start;
}

.message.right {
    justify-content: flex-end;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0;
    flex-shrink: 0;
    background-color: #ccc;
}

.message.left .avatar {
    margin-right: 8px;
}

.message.right .avatar {
    margin-left: 8px;
}

.message-content {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.left .message-bubble {
    border-bottom-left-radius: 2px;
}

.message.right .message-bubble {
    background-color: #95ec69;
    border-bottom-right-radius: 2px;
}

.message-bubble p {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    word-break: break-all;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    padding: 0 6px;
}

.message.left .message-time {
    text-align: left;
}

.message.right .message-time {
    text-align: right;
}

.chat-footer {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #f7f7f7;
    border-top: 1px solid #e5e5e5;
    gap: 8px;
    flex-shrink: 0;
}

.footer-left {
    display: flex;
    align-items: center;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.footer-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-btn:active {
    background-color: #e5e5e5;
    border-radius: 50%;
}

.input-area {
    flex: 1;
    background-color: #fff;
    border-radius: 20px;
    padding: 8px 16px;
    border: 1px solid #e5e5e5;
    min-width: 0;
}

.input-area input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.input-area input::placeholder {
    color: #ccc;
}

.send-btn {
    background: none;
    border: none;
    padding: 6px;
    width: auto;
    height: auto;
}

.record-btn {
    width: 100%;
    height: 40px;
    background-color: #fff;
    border: none;
    border-radius: 20px;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background-color 0.2s;
}

.record-btn:hover {
    background-color: #f5f5f5;
}

.record-btn.recording {
    background-color: #ff4d4d;
    color: #fff;
}

.record-text {
    font-size: 16px;
}

.record-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.record-wave {
    width: 4px;
    height: 16px;
    background-color: #fff;
    border-radius: 2px;
    animation: wave 0.8s ease-in-out infinite;
}

.record-wave:nth-child(2) {
    animation-delay: 0.2s;
}

.record-wave:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wave {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 24px;
    }
}

.record-time {
    font-size: 16px;
    font-weight: bold;
    margin-left: 8px;
}

.voice-bubble {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    gap: 12px;
    min-width: 100px;
}

.voice-left {
    background-color: #fff;
    border-radius: 20px 20px 20px 4px;
}

.voice-right {
    background-color: #95ec69;
    border-radius: 20px 20px 4px 20px;
}

.voice-play-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
}

.voice-waveform span {
    width: 4px;
    background-color: #ccc;
    border-radius: 2px;
    min-height: 8px;
}

.voice-right .voice-waveform span {
    background-color: #fff;
}

.voice-left .voice-waveform span {
    background-color: #999;
}

.voice-duration {
    font-size: 14px;
    color: #999;
    flex-shrink: 0;
}

.voice-right .voice-duration {
    color: #fff;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-right .footer-btn {
    padding: 8px;
}

.footer-menu {
    display: none;
    background-color: #f7f7f7;
    padding: 16px;
    border-top: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.footer-menu-grid {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.footer-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #333;
}

.footer-menu-item span {
    font-size: 14px;
}

.footer-menu-item:active {
    opacity: 0.7;
}

.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 320px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.modal-body {
    padding: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #95ec69;
}

.form-group input[readonly] {
    background-color: #f7f7f7;
    color: #333;
}

.error-message {
    color: #ff4757;
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
    min-height: 18px;
}

.modal-footer {
    display: flex;
    border-top: 1px solid #eee;
}

.modal-btn {
    flex: 1;
    padding: 14px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-btn.cancel {
    color: #666;
    background-color: #f5f5f5;
    border-right: 1px solid #eee;
}

.modal-btn.cancel:active {
    background-color: #e5e5e5;
}

.modal-btn.confirm {
    color: #333;
    background-color: #95ec69;
}

.modal-btn.confirm:active {
    background-color: #7ed650;
}

.more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 200;
    min-width: 120px;
    overflow: hidden;
}

.menu-item {
    padding: 12px 20px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    text-align: center;
}

.menu-item:active {
    background-color: #f5f5f5;
}

.uid-list {
    max-height: 200px;
    overflow-y: auto;
}

.uid-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.uid-item:last-child {
    border-bottom: none;
}

.uid-item:active {
    background-color: #f5f5f5;
}

.uid-number {
    font-size: 15px;
    color: #333;
}

.uid-time {
    font-size: 13px;
    color: #999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #95ec69;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-messages p {
    color: #999;
    font-size: 14px;
}

@media (max-width: 480px) {
    .chat-container {
        max-width: 100%;
    }
    
    .message-content {
        max-width: 75%;
    }
    
    .auth-container {
        margin: 20px;
        padding: 20px;
    }
}