:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

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

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    text-align: center;
    padding: 40px 0 20px;
}

.logo {
    height: 112px;
    width: auto;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}
.logo:hover {
    transform: scale(1.05);
}

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.hero-section {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    max-width: 480px;
    width: 100%;
    border: 1px solid var(--border-color);
}

.hero-section h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero-section p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.6;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.btn {
    padding: 14px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.join-form {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    animation: fadeIn 0.3s ease-out;
}

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

.join-form input {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    width: 100%;
    background: #f9fafb;
    transition: all 0.2s;
}
.join-form input:focus {
    background: #fff;
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hidden {
    display: none !important;
}

.form-container {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--border-color);
}

.form-container h1 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--text-main);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    background: #f9fafb;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.success-message {
    text-align: center;
}

.success-message h2 {
    color: var(--success);
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.chat-urls {
    margin: 24px 0;
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.url-section {
    margin-bottom: 20px;
    text-align: left;
}
.url-section:last-child { margin-bottom: 0; }

.url-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.url-section input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
}
.url-section input:hover {
    border-color: var(--primary-color);
}

.footer {
    padding: 40px 0;
    text-align: center;
    margin-top: auto;
}

.app-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
}

.app-link img {
    height: 44px;
    width: auto;
    transition: transform 0.2s ease;
}

.app-link img:hover {
    transform: scale(1.05);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text-main);
}

/* Language Selector */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.language-button:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.language-button .flag {
    font-size: 1.2rem;
    line-height: 1;
}

.language-button .lang-name {
    font-weight: 500;
}

.language-button .arrow {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 4px;
}

.language-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.language-menu.show {
    display: block;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: var(--bg-color);
}

.language-option.active {
    background: #e0f2fe;
    color: var(--primary-color);
    font-weight: 500;
}

.language-option .flag {
    font-size: 1.3rem;
    line-height: 1;
}

/* RTL Support */
[dir="rtl"] body {
    direction: rtl;
}

[dir="rtl"] .language-selector {
    left: 20px;
    right: auto;
}

[dir="rtl"] .language-menu {
    left: 0;
    right: auto;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }
    
    .logo {
        height: 72px;
    }
    
    .hero-section,
    .form-container {
        padding: 24px;
        border-radius: 20px;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .join-form {
        flex-direction: column;
        width: 100%;
    }
    
    .join-form input {
        width: 100%;
    }
    .join-form button {
        width: 100%;
    }
    
    .footer-links {
        gap: 16px;
        flex-direction: column;
    }
}
