/* 
 * 风扇的部屋 - Global Styles
 * Pure CSS, no framework dependencies
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500&display=swap');

/* CSS Variables */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: rgba(26, 26, 26, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --glow-white: rgba(255, 255, 255, 0.1);
    --purple: rgba(147, 112, 219, 1);
    --purple-glow: rgba(147, 112, 219, 0.3);
    --cyan: rgba(100, 200, 255, 1);
    --cyan-glow: rgba(100, 200, 255, 0.3);
    --pink: rgba(255, 153, 153, 1);
    --pink-glow: rgba(255, 153, 153, 0.3);
    --font-main: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

a:hover {
    color: var(--text-secondary);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.main-title {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.5rem;
    text-shadow: 0 0 20px var(--glow-white);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--text-muted);
    letter-spacing: 0.2rem;
}

/* Avatar */
.avatar-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    box-shadow: 0 0 30px var(--glow-white);
    object-fit: cover;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    padding: 1.5rem 2rem;
    margin: 1rem 0;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.03);
}

.glass-card h3 {
    font-weight: 400;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.glass-card p {
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.9rem;
}

/* Rooms Grid */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.room-card {
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.room-card h4 {
    font-weight: 400;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.room-card p {
    font-weight: 300;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-grow: 1;
}

.room-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Room Card Variants */
.room-card-purple {
    border: 1px solid rgba(147, 112, 219, 0.4);
    box-shadow: 0 0 15px var(--purple-glow);
}

.room-card-purple:hover {
    border-color: rgba(147, 112, 219, 0.7);
    box-shadow: 0 0 25px rgba(147, 112, 219, 0.5);
}

.room-card-cyan {
    border: 1px solid rgba(100, 200, 255, 0.4);
    box-shadow: 0 0 15px var(--cyan-glow);
}

.room-card-cyan:hover {
    border-color: rgba(100, 200, 255, 0.7);
    box-shadow: 0 0 25px rgba(100, 200, 255, 0.5);
}

.room-card-pink {
    border: 1px solid rgba(255, 153, 153, 0.4);
    box-shadow: 0 0 15px var(--pink-glow);
}

.room-card-pink:hover {
    border-color: rgba(255, 153, 153, 0.7);
    box-shadow: 0 0 25px rgba(255, 153, 153, 0.5);
}

/* Third card spans full width on grid */
.rooms-grid .room-card:nth-child(3) {
    grid-column: 1;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-subtle), transparent);
    margin: 3rem auto;
    width: 80%;
}

/* Social Section */
.social-section {
    text-align: center;
    margin: 2rem 0;
}

.social-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.qr-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.qr-item {
    text-align: center;
    padding: 0.3rem;
}

.qr-img {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
}

.qr-label {
    color: var(--text-secondary);
    font-size: 0.65rem;
    margin-top: 0.4rem;
    margin-bottom: 0;
}

.qr-sublabel {
    color: var(--text-muted);
    font-size: 0.55rem;
    margin-top: 2px;
}

/* Footer */
.footer {
    text-align: center;
    color: #444444;
    font-size: 0.75rem;
    margin-top: 3rem;
    font-weight: 300;
}

/* ============ Room Page Styles ============ */

.room-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.room-title {
    font-size: 1.5rem;
    font-weight: 400;
}

/* Key Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-weight: 400;
}

.modal-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.modal-input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.modal-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.modal-btn:hover {
    opacity: 0.9;
}

.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 400px;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    max-width: 85%;
    line-height: 1.8;
    white-space: pre-wrap;
}

.message-user {
    background: rgba(100, 200, 255, 0.15);
    border: 1px solid rgba(100, 200, 255, 0.3);
    align-self: flex-end;
}

.message-assistant {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    align-self: flex-start;
}

/* Input Area */
.input-area {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-subtle);
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    resize: none;
}

.chat-input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.send-btn {
    padding: 0.8rem 1.5rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    cursor: pointer;
    transition: opacity 0.2s;
}

.send-btn:hover {
    opacity: 0.9;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* User Data Form */
.user-data-form {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.user-data-form h3 {
    margin-bottom: 1rem;
    font-weight: 400;
}

.user-data-form textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 1rem;
}

.user-data-form textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.submit-data-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-radius: 50%;
    border-top-color: var(--text-primary);
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .main-title {
        font-size: 1.8rem;
        letter-spacing: 0.3rem;
    }
    
    .rooms-grid {
        grid-template-columns: 1fr;
    }
    
    .rooms-grid .room-card:nth-child(3) {
        grid-column: 1;
    }
    
    .room-card {
        padding: 1rem;
    }
    
    .room-card h4 {
        font-size: 1rem;
    }
    
    .qr-grid {
        gap: 0.5rem;
    }
    
    .qr-img {
        width: 60px;
        height: 60px;
    }
    
    .message {
        max-width: 95%;
    }
}

/* Hide scrollbar but allow scrolling */
.messages-area::-webkit-scrollbar {
    width: 6px;
}

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

.messages-area::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
