/* VibeCoding 스타일 - 깔끔하고 모던하게 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
}

/* 랜딩 페이지 */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 60px;
}

header h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.3rem;
    opacity: 0.95;
}

.hero {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.hero h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.hero p {
    color: #666;
    font-size: 1.15rem;
}

.actions {
    background: white;
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.btn-primary, .btn-secondary {
    padding: 16px 35px;
    font-size: 1.15rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

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

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

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    margin-left: 12px;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.or {
    margin: 25px 0;
    color: #999;
    font-size: 1.05rem;
}

#roomInput {
    padding: 14px 22px;
    font-size: 1.05rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    width: 320px;
    margin-bottom: 12px;
    transition: border-color 0.3s;
}

#roomInput:focus {
    outline: none;
    border-color: #667eea;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 45px;
}

.feature {
    background: white;
    border-radius: 16px;
    padding: 35px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
}

.feature h3 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.feature p {
    color: #666;
    font-size: 1.05rem;
}

footer {
    text-align: center;
    color: white;
    margin-top: 65px;
    opacity: 0.85;
    font-size: 1.05rem;
}

footer a {
    color: white;
    text-decoration: underline;
    transition: opacity 0.3s;
}

footer a:hover {
    opacity: 0.8;
}

/* 방 페이지 */
.room-page {
    background: #1e1e2e;
    color: #cdd6f4;
    height: 100vh;
    overflow: hidden;
}

.room-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.room-header {
    background: #181825;
    padding: 18px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #313244;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.room-info h1 {
    font-size: 1.6rem;
    color: #cba6f7;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.room-id {
    margin-top: 6px;
    font-size: 0.95rem;
    color: #a6adc8;
}

.room-id strong {
    color: #f9e2af;
    font-weight: 600;
}

.btn-copy {
    margin-left: 12px;
    padding: 6px 16px;
    background: #313244;
    border: none;
    border-radius: 6px;
    color: #cdd6f4;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-copy:hover {
    background: #45475a;
}

.room-stats {
    display: flex;
    gap: 25px;
    align-items: center;
}

.user-count {
    font-size: 1rem;
    color: #a6adc8;
}

.status {
    padding: 6px 18px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status.connected {
    background: #a6e3a1;
    color: #1e1e2e;
}

.status.error {
    background: #f38ba8;
    color: #1e1e2e;
}

.status.reconnecting {
    background: #f9e2af;
    color: #1e1e2e;
}

.room-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    padding: 25px;
    overflow: hidden;
}

.editor-container, .preview-container {
    background: #181825;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.editor-header, .preview-header {
    padding: 16px 22px;
    background: #181825;
    border-bottom: 1px solid #313244;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header h3, .preview-header h3 {
    color: #cba6f7;
    font-size: 1.05rem;
}

#editor {
    flex: 1;
    width: 100%;
    padding: 22px;
    background: #1e1e2e;
    border: none;
    color: #cdd6f4;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14.5px;
    line-height: 1.7;
    resize: none;
}

#editor:focus {
    outline: none;
}

.preview-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.preview-controls label {
    font-size: 0.9rem;
    color: #a6adc8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-controls select {
    padding: 6px 12px;
    background: #313244;
    border: 1px solid #45475a;
    border-radius: 6px;
    color: #cdd6f4;
    font-size: 0.9rem;
}

#preview {
    flex: 1;
    margin: 0;
    padding: 22px;
    overflow: auto;
    background: #1e1e2e;
}

#preview code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14.5px;
    line-height: 1.7;
}

/* 히스토리 패널 */
.history-panel {
    position: fixed;
    right: -450px;
    top: 0;
    width: 450px;
    height: 100vh;
    background: #181825;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.4);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.history-panel.open {
    right: 0;
}

.history-header {
    padding: 22px;
    background: #1e1e2e;
    border-bottom: 2px solid #313244;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    color: #cba6f7;
    font-size: 1.15rem;
}

#toggleHistory {
    padding: 6px 16px;
    background: #313244;
    border: none;
    border-radius: 6px;
    color: #cdd6f4;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

#toggleHistory:hover {
    background: #45475a;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
}

.history-item {
    background: #1e1e2e;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    border-left: 3px solid #cba6f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.history-time {
    font-size: 0.85rem;
    color: #a6adc8;
    margin-bottom: 6px;
}

.history-user {
    font-size: 0.9rem;
    color: #f9e2af;
    margin-bottom: 10px;
    font-weight: 600;
}

.history-content {
    background: #313244;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #cdd6f4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.btn-history {
    position: fixed;
    right: 25px;
    bottom: 25px;
    padding: 16px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(102, 126, 234, 0.5);
    transition: all 0.3s;
    z-index: 999;
    font-weight: 600;
}

.btn-history:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.6);
}

.loading, .empty, .error {
    text-align: center;
    color: #a6adc8;
    padding: 45px 22px;
    font-size: 1.05rem;
}

.error {
    color: #f38ba8;
}

/* 스크롤바 스타일 (WebKit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1e1e2e;
}

::-webkit-scrollbar-thumb {
    background: #45475a;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #585b70;
}

/* 반응형 (모바일) */
@media (max-width: 768px) {
    .room-main {
        grid-template-columns: 1fr;
    }
    
    .preview-container {
        display: none; /* 모바일에서는 미리보기 숨김 */
    }
    
    .history-panel {
        width: 100%;
        right: -100%;
    }
}
