:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --danger-color: #ef4444;
    --bg-color: #000000;
    --surface-color: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Alibaba PuHuiTi 2.0", "Alibaba PuHuiTi", "PingFang SC", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Mobile viewport fix */
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

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

/* Join Screen - Mobile First */
#join-screen {
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 24px;
}

.card {
    width: 100%;
    max-width: 360px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    animation: fadeInUp 0.6s ease-out;
}

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

.logo {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 48px;
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 20px;
}

input {
    width: 100%;
    height: 56px; /* Larger touch target */
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0 56px 0 48px; /* Added right padding for copy button */
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

.icon-btn-inside {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-inside:active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

.icon-btn-inside i {
    font-size: 20px;
}

input:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.4);
}

.primary-btn {
    width: 100%;
    height: 56px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn:active::after {
    opacity: 1;
}

.warning {
    margin-top: 20px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 12px;
    color: #fca5a5;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Call Screen - Mobile Optimized */
#call-screen {
    height: 100%;
    width: 100%;
    background: #000;
    position: relative;
}

.video-grid {
    height: 100%;
    width: 100%;
    position: relative;
}

/* Remote Video - Full Screen */
.video-container.remote {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-label {
    display: none; /* Hide labels on mobile for cleaner look */
}

/* Local Video - Floating PIP */
.video-container.local {
    position: absolute;
    top: 24px;
    right: 16px;
    width: 120px; /* Slightly larger for better visibility */
    height: 160px;
    background: #1e1e1e;
    border-radius: 16px;
    overflow: hidden;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}

#local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror local video */
}

/* Header Info */
.header-overlay {
    position: absolute;
    top: 24px;
    left: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.room-badge, .status-badge {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 100px;
    color: white;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

/* Placeholder State */
.placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    z-index: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Bottom Controls */
.controls-bar {
    position: absolute;
    bottom: 32px;
    left: 24px;
    right: 24px;
    height: 72px;
    background: rgba(22, 22, 22, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    z-index: 20;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.control-btn:active {
    transform: scale(0.9);
}

.control-btn.active {
    background: white;
    color: black;
}

.control-btn.inactive {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.5);
}

/* Removed strikethrough line as we use specific icons for off state */

.control-btn.danger {
    background: #ff4757;
    color: white;
}

.control-btn i {
    font-size: 22px;
}
