/* Base Styles */
:root {
    --primary-color: #4a6ee0;
    --secondary-color: #6c8ff8;
    --accent-color: #f45b69;
    --text-color: #333;
    --light-text: #fff;
    --background-color: #f9f9f9;
    --card-background: #fff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    z-index: 10;
}

/* Landing Screen */
.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.logo-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.logo-container p {
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.8;
}

.room-controls {
    width: 100%;
    max-width: 400px;
    margin-bottom: 30px;
}

#room-input {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#room-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.primary-btn {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.primary-btn:hover {
    background-color: var(--secondary-color);
}

.secondary-btn {
    width: 100%;
    padding: 15px;
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.secondary-btn:hover {
    background-color: rgba(74, 110, 224, 0.1);
}

.instructions {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.instructions p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.share-url {
    display: flex;
    align-items: center;
    background-color: var(--card-background);
    padding: 12px 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-top: 10px;
}

.share-url span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
}

.icon-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.icon-btn:hover img {
    opacity: 1;
}

/* Call Screen */
#call-screen {
    padding: 0;
    background-color: #000;
}

.remote-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #222;
    z-index: 1;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 2;
}

.local-video-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 3;
    border: 2px solid white;
    touch-action: none; /* For draggable functionality */
}

#local-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror effect */
}

.call-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 3;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn img {
    width: 24px;
    height: 24px;
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.end-call {
    background-color: var(--accent-color);
}

.end-call:hover {
    background-color: #d84555;
}

.connection-status {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s;
}

.connection-status.visible {
    opacity: 1;
}

/* Waiting Screen */
.waiting-container {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px var(--shadow-color);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(74, 110, 224, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.waiting-container h2 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.waiting-container p {
    margin-bottom: 10px;
    opacity: 0.8;
}

/* Media Queries for larger screens */
@media (min-width: 768px) {
    .local-video-container {
        width: 180px;
        height: 240px;
    }
    
    .control-btn {
        width: 70px;
        height: 70px;
    }
    
    .control-btn img {
        width: 28px;
        height: 28px;
    }
}