/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #4a5568;
    font-size: 2rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-weight: 600;
    color: #2d3748;
}

/* 섹션 */
.section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.hidden {
    display: none !important;
}

/* 인증 섹션 */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

/* 버튼 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 채팅 섹션 */
.chat-container {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.chat-header h2 {
    color: #4a5568;
    font-size: 1.5rem;
}

.room-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.room-input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
}

.room-input:focus {
    outline: none;
    border-color: #667eea;
}

/* 채팅 메시지 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #e2e8f0;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
}

.message.own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.other {
    background: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.message.system {
    background: #fef5e7;
    color: #744210;
    border: 2px solid #f6e05e;
    text-align: center;
    margin: 0 auto;
    max-width: 90%;
}

.message-header {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* 채팅 입력 */
.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

#message-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#message-input:disabled {
    background: #f7fafc;
    cursor: not-allowed;
}

/* 상태 메시지 */
.status {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.status.success {
    background: #c6f6d5;
    color: #22543d;
    border: 2px solid #68d391;
}

.status.error {
    background: #fed7d7;
    color: #742a2a;
    border: 2px solid #fc8181;
}

.status.info {
    background: #bee3f8;
    color: #2a4365;
    border: 2px solid #63b3ed;
}

/* 연결 상태 */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.connection-status.connected {
    background: rgba(72, 187, 120, 0.9);
    color: white;
}

.connection-status.disconnected {
    background: rgba(245, 101, 101, 0.9);
    color: white;
}

.connection-status.connecting {
    background: rgba(237, 137, 54, 0.9);
    color: white;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .room-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .room-input {
        width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
    
    .connection-status {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 20px;
        text-align: center;
    }
}

/* 스크롤바 스타일 */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
