@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #74ebd5 0%, #acb6e5 100%);
    color: #333;
}

header {
    background-color: #1a1a1a;
    color: #fff;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

header.with-logout {
    justify-content: space-between;
}

header h1 {
    margin: 0;
    font-size: 2em;
    letter-spacing: 1px;
}

header h1 a {
    text-decoration: none;
    color: inherit;
}

.logout-button {
    padding: 8px 15px;
    background-color: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
    z-index: 100;
}

.logout-button:hover {
    background-color: #da190b;
}

main {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

.form-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.form-container h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
    color: #333;
}

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

.form-container input, .form-container select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1em;
}

.form-container input:focus, .form-container select:focus {
    border-color: #2196F3;
    outline: none;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.5);
}

.form-container button {
    width: 100%;
    padding: 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.form-container button:hover {
    background-color: #45a049;
    transform: scale(1.02);
}

.form-container button:active {
    transform: scale(0.98);
}

.form-container .error-message {
    color: #f44336;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.form-container .success-message {
    color: #4CAF50;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.form-container .links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.form-container a {
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.1s ease;
}

.form-container a:hover {
    background-color: #0b7dda;
    transform: scale(1.02);
}

.form-container a:active {
    transform: scale(0.98);
}

.video-chat {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 15px; /* Reduced from 30px */
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 2000px;
    width: 100%;
    backdrop-filter: blur(5px);
    max-height: calc(100vh - 150px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.device-selection {
    margin-bottom: 20px;
}

.device-selection label {
    margin-right: 10px;
    font-weight: bold;
}

.device-selection select {
    padding: 5px;
    border-radius: 5px;
}

#placeholder p {
    font-size: 1.5em; /* Reduced from 1.8em */
    margin-bottom: 15px; /* Reduced from 25px */
    color: #444;
}

#actionButton {
    padding: 12px 30px;
    font-size: 1.3em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#actionButton:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

#actionButton:active {
    transform: scale(0.95);
}

.videos {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 5px;
}

.video-wrapper {
    width: calc(50% - 2.5px);
    aspect-ratio: 16/9;
    position: relative;
}

.local-video {
    order: 1;
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#remoteLogo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #000;
    z-index: 1;
}

#remoteVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #000;
    display: none;
    z-index: 2;
}

#remotePreview {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#remotePreview h2 {
    font-size: 1.5em;
    margin: 0;
}

#remotePreview p {
    font-size: 1.2em;
    margin: 5px 0;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

#nextChat, #stopChat {
    padding: 12px 25px;
    font-size: 1.2em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#nextChat {
    background-color: #2196F3;
    color: white;
}

#nextChat:hover {
    background-color: #0b7dda;
    transform: scale(1.05);
}

#nextChat:active {
    transform: scale(0.95);
}

#stopChat {
    background-color: #f44336;
    color: white;
}

#stopChat:hover {
    background-color: #da190b;
    transform: scale(1.05);
}

#stopChat:active {
    transform: scale(0.95);
}

.login-prompt {
    text-align: center;
    padding: 30px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

.login-prompt p {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: #444;
}

.login-prompt a {
    padding: 12px 30px;
    font-size: 1.3em;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: transform 0.1s ease, background-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.login-prompt a:hover {
    background-color: #0b7dda;
    transform: scale(1.05);
}

.login-prompt a:active {
    transform: scale(0.95);
}

@media (max-width: 600px) {
    .videos {
        flex-direction: column;
        gap: 15px;
    }
    video {
        width: 100%;
        max-width: none;
        margin-bottom: 15px;
    }
    .video-wrapper {
        width: 100%;
        max-width: none;
        aspect-ratio: 16/9;
    }
    .video-wrapper video {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    #actionButton, #nextChat, #stopChat, .login-prompt a {
        padding: 10px 20px;
        font-size: 1.1em;
    }
    .controls {
        flex-direction: column;
        gap: 10px;
        margin-top: 15px;
    }
    .form-container {
        padding: 20px;
    }
    .form-container h2 {
        font-size: 1.5em;
    }
    .form-container button {
        font-size: 1em;
    }
    .form-container a {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}

@media (max-width: 1200px) {
    .video-chat {
        max-height: calc(100vh - 200px);
    }
}   

#searchingMessage, #statusMessage {
    display: none;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 5px;
}

#userPreview {
    display: none;
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px;
    border-radius: 5px;
}

#noPartnerMessage {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}