/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #e2e8f0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    position: relative;
    overflow: hidden;
    cursor: default;
}

/* Mouse Glow Follower */
.mouse-glow {
    position: fixed;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(120, 80, 220, 0.12) 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 0;
    transition: left 0.08s ease-out, top 0.08s ease-out;
    mix-blend-mode: screen;
}

/* Floating Shapes Background */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: floatUp 20s infinite ease-in-out;
}

.shape-1 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #f093fb, #f5576c);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #4facfe, #00f2fe);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #43e97b, #38f9d7);
    top: 20%;
    right: -50px;
    animation-delay: -10s;
}

.shape-4 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #fa709a, #fee140);
    bottom: 20%;
    left: -80px;
    animation-delay: -15s;
}

.shape-5 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, #a18cd1, #fbc2eb);
    top: 60%;
    right: 10%;
    animation-delay: -3s;
}

.shape-6 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, #fccb90, #d57eeb);
    top: 10%;
    left: 20%;
    animation-delay: -8s;
}

@keyframes floatUp {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    25% {
        transform: translate(30px, -40px) scale(1.1) rotate(5deg);
    }
    50% {
        transform: translate(-20px, -80px) scale(0.9) rotate(-3deg);
    }
    75% {
        transform: translate(40px, -30px) scale(1.05) rotate(4deg);
    }
    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
}

/* Container - More Transparent Glassmorphism */
.container {
    position: relative;
    z-index: 1;
    background: rgba(20, 18, 40, 0.35);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 32px;
    padding: 32px 24px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Form Container - Mouse Tracking Animation */
.form-container {
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

/* Logo Section */
.logo {
    text-align: center;
    margin-bottom: 24px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    border: 2px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed, #6d28d9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 2px;
}

.logo .sub {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 400;
    margin-top: 2px;
    letter-spacing: -0.2px;
}

.logo .brand {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Capacity Badge */
.capacity {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    display: inline-block;
    padding: 5px 16px;
    border-radius: 40px;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.06);
    letter-spacing: -0.1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.capacity.full {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.capacity.good {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    padding: 4px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border-radius: 32px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: #94a3b8;
    transition: none;
    background: transparent;
    letter-spacing: -0.2px;
}

.tab.active {
    background: rgba(124, 58, 237, 0.2);
    color: #c4b5fd;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
    border: 1px solid rgba(124, 58, 237, 0.15);
    font-weight: 600;
}

/* Input Groups */
.input-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
    letter-spacing: -0.2px;
}

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 2px solid rgba(124, 58, 237, 0.12);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    color: #e2e8f0;
    font-size: 15px;
    outline: none;
    transition: border 0.3s ease, box-shadow 0.3s ease;
    font-weight: 400;
}

input:focus {
    border-color: #7c3aed;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.08);
}

input::placeholder {
    color: #64748b;
    font-weight: 400;
}

.hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #64748b;
    font-weight: 400;
    letter-spacing: -0.1px;
}

/* Buttons */
button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: none;
    letter-spacing: -0.2px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}

button:active {
    transform: scale(0.98);
    opacity: 0.9;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Status Box */
.status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13px;
    display: none;
    text-align: center;
    line-height: 1.5;
    font-weight: 450;
}

.status.success {
    background: rgba(52, 211, 153, 0.1);
    color: #6ee7b7;
    display: block;
    border: 1px solid rgba(52, 211, 153, 0.12);
}

.status.error {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    display: block;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.status.info {
    background: rgba(124, 58, 237, 0.08);
    color: #a78bfa;
    display: block;
    border: 1px solid rgba(124, 58, 237, 0.1);
}

/* Support Button */
.support-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.support-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(124, 58, 237, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 18px;
    border-radius: 50px;
    color: #c4b5fd;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(124, 58, 237, 0.2);
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.support-link:hover {
    background: rgba(124, 58, 237, 0.25);
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
}

.support-link svg {
    width: 18px;
    height: 18px;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: #64748b;
    letter-spacing: -0.1px;
    font-weight: 400;
}

.footer p {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 16px;
}

/* Utility */
.hidden {
    display: none !important;
}

/* ============================================
   PAIRING CODE MODAL - CENTERED POPUP
   ============================================ */
.pairing-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.pairing-modal.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pairing-modal-content {
    background: rgba(20, 18, 40, 0.9);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 32px;
    padding: 40px 36px 32px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(124, 58, 237, 0.2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pairing-title {
    font-size: 16px;
    color: #94a3b8;
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.pairing-code {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: 16px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 16px 0 20px;
    font-family: 'SF Mono', 'Menlo', monospace;
    text-align: center;
    padding: 0 10px;
    word-break: break-all;
}

.copy-btn {
    background: rgba(124, 58, 237, 0.15);
    border: 2px solid rgba(124, 58, 237, 0.3);
    padding: 12px 32px;
    width: auto;
    font-size: 16px;
    font-weight: 600;
    border-radius: 40px;
    display: inline-block;
    margin: 4px auto 0;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.15);
    color: #c4b5fd;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(124, 58, 237, 0.25);
    border-color: rgba(124, 58, 237, 0.5);
    transform: scale(1.02);
}

.copy-btn:active {
    transform: scale(0.95);
}

.pairing-hint {
    font-size: 13px;
    color: #64748b;
    margin-top: 16px;
    line-height: 1.5;
    font-weight: 400;
    text-align: center;
}

.close-modal-btn {
    margin-top: 18px;
    padding: 10px 24px;
    width: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .container {
        padding: 20px 16px 20px;
        border-radius: 24px;
        max-width: 100%;
        background: rgba(20, 18, 40, 0.4);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.04);
    }
    
    .logo-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .logo .sub {
        font-size: 13px;
    }
    
    .capacity {
        font-size: 11px;
        padding: 4px 14px;
    }
    
    .tabs {
        margin-bottom: 18px;
        border-radius: 32px;
    }
    
    .tab {
        font-size: 13px;
        padding: 8px 6px;
        border-radius: 28px;
    }
    
    .input-group {
        margin-bottom: 14px;
    }
    
    label {
        font-size: 12px;
    }
    
    input {
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 12px;
    }
    
    .hint {
        font-size: 10px;
    }
    
    button {
        padding: 12px;
        font-size: 14px;
        border-radius: 12px;
    }
    
    .status {
        font-size: 12px;
        padding: 10px 14px;
        margin-top: 14px;
    }
    
    .footer {
        font-size: 11px;
        margin-top: 18px;
    }
    
    .footer p {
        padding-top: 14px;
    }
    
    .mouse-glow {
        display: none;
    }
    
    .support-btn {
        top: 12px;
        right: 12px;
    }
    
    .support-link {
        padding: 8px 14px;
        font-size: 12px;
        gap: 6px;
    }
    
    .support-link svg {
        width: 16px;
        height: 16px;
    }
    
    /* Modal responsive */
    .pairing-modal-content {
        padding: 28px 20px 24px;
        border-radius: 24px;
        max-width: 100%;
    }
    
    .pairing-code {
        font-size: 32px;
        letter-spacing: 10px;
    }
    
    .copy-btn {
        font-size: 14px;
        padding: 10px 24px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 28px 20px 24px;
        max-width: 380px;
    }
    
    .mouse-glow {
        display: none;
    }
}

@media (min-width: 769px) {
    .container {
        padding: 36px 28px 28px;
        max-width: 420px;
    }
}
select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 15px;
    outline: none;
    cursor: pointer;
}

select:focus {
    border-color: #7c3aed;
}

select option {
    background: #1a1a2e;
    color: white;
}

/* Waiting spinner */
.wait-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(124, 58, 237, 0.2);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.wait-text {
    text-align: center;
    line-height: 1.5;
    font-size: 0.95rem;
}
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(124, 58, 237, 0.15);
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 2px;
    transition: width 0.3s ease;
}
/* Input shake on invalid number */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}
#phoneInput.shake {
    animation: shake 0.4s ease;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}