/**
 * Premium Modern UI - Dark Theme
 * Human-designed, production-ready
 * Light animations, clean polish
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Premium Dark Palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1e1e1e;
    --bg-hover: #282828;
    --bg-elevated: #242424;
    
    /* Text Colors */
    --text-primary: #f5f5f5;
    --text-secondary: #b8b8b8;
    --text-muted: #6b6b6b;
    --text-disabled: #4a4a4a;
    
    /* Accent - Premium Blue */
    --accent: #5b8cff;
    --accent-hover: #6b9cff;
    --accent-active: #4b7cff;
    --accent-glow: rgba(91, 140, 255, 0.15);
    
    /* Status Colors */
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    
    /* Borders & Shadows */
    --border: #2a2a2a;
    --border-light: #353535;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'SF Pro Display', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'kern' 1;
    text-rendering: optimizeLegibility;
}

/* ============================================
   PAGE LOAD ANIMATION - Light fade-in
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    animation: fadeIn 0.25s ease-out;
}

/* ============================================
   LANDING PAGE - PREMIUM DESIGN
   ============================================ */

.landing-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: 
        radial-gradient(circle at 20% 50%, rgba(91, 140, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(91, 140, 255, 0.05) 0%, transparent 50%),
        var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.landing-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(180deg, transparent 0%, rgba(91, 140, 255, 0.02) 100%);
    pointer-events: none;
}

.landing-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 56px 48px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.landing-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-light);
}

.landing-header {
    text-align: center;
    margin-bottom: 48px;
}

.landing-header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent) 0%, #7ba3ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Form Styles - Premium Inputs */
.room-form {
    margin-top: 40px;
}

.form-group {
    margin-bottom: 28px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

.form-group input {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 400;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    letter-spacing: 0.1px;
}

.form-group input:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.form-group input:focus {
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 4px var(--accent-glow);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-hint {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}

/* Premium Buttons */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 36px;
}

.btn {
    flex: 1;
    padding: 16px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.2px;
    box-shadow: var(--shadow-sm);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    transform: translate(-50%, -50%);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active::before {
    width: 400px;
    height: 400px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-md), 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow-md);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow-sm);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Error Message - Premium Style */
.error-message {
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 12px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
.landing-footer {
    margin-top: 40px;
    text-align: center;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.landing-footer p {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.1px;
}

/* ============================================
   ROOM CREATION POPUP - PREMIUM MODAL
   ============================================ */

.room-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 24px;
}

.room-popup-show {
    opacity: 1;
}

.room-popup-content {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    transform: scale(0.96) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.room-popup-show .room-popup-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.room-popup-header {
    margin-bottom: 28px;
    text-align: center;
}

.room-popup-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.room-popup-body {
    margin-bottom: 28px;
}

.room-popup-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

.room-id-display {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.room-id-display input {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Courier New', monospace;
    letter-spacing: 2px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.room-id-display input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    outline: none;
}

.btn-copy {
    padding: 16px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.2px;
}

.btn-copy:hover {
    background: var(--accent-hover);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-glow);
}

.btn-copy:active {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow-md);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-copy-success {
    background: var(--success) !important;
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(74, 222, 128, 0.15) !important;
}

.room-popup-hint {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

.room-popup-footer {
    display: flex;
    justify-content: center;
}

.room-popup-footer .btn {
    min-width: 220px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 640px) {
    .landing-card {
        padding: 40px 28px;
        border-radius: 16px;
    }

    .landing-header h1 {
        font-size: 30px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
    }

    .room-popup-content {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .room-id-display {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
        justify-content: center;
    }

    .room-popup-header h2 {
        font-size: 24px;
    }
}

/* ============================================
   ROOM CLOSED TOAST (Home Page Popup)
   ============================================ */

.room-closed-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10001;
    opacity: 0;
    transform: translateX(400px);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.room-closed-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.room-closed-toast-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
}

.room-closed-toast-content svg {
    color: var(--danger);
    flex-shrink: 0;
}

.room-closed-toast-content span {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .room-closed-toast {
        top: 16px;
        right: 16px;
        left: 16px;
        transform: translateY(-100px);
    }
    
    .room-closed-toast.show {
        transform: translateY(0);
    }
    
    .room-closed-toast-content {
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .landing-container {
        padding: 16px;
    }

    .landing-card {
        padding: 32px 24px;
    }

    .landing-header h1 {
        font-size: 28px;
    }

    .form-group input {
        padding: 14px 18px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
