/*
Theme Name: Operra
Author: Antigravity
Version: 1.0
Description: A custom theme integrating Avaturn and OpenAI Realtime.
*/

@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap");

html,
body {
    height: 100%;
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    margin: 0;
    font-family: Roboto, "Helvetica Neue", sans-serif;
    background-color: white;
}

/* --- StartComponent Styles --- */

.main-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: white;
    overflow: hidden;
    position: relative;
    align-items: center;
    justify-content: flex-end;
    font-family: 'Inter', sans-serif;
}

.pip-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    aspect-ratio: 16/9;
    z-index: 40;
    transition: background-color 0.3s;
    background: #eee;
    pointer-events: auto;
    /* Allow interaction */
}

/* Top Controls */
.top-controls {
    display: flex;
    align-items: center;
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 40;
    gap: 10px;
}

.control-btn {
    border: 2px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 8px 16px;
    background: white;
    cursor: pointer;
    font-weight: 500;
}

.control-btn:hover {
    background: #f9fafb;
}

/* Avatar Area */
.avatar-area {
    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    background: white;
    overflow: hidden;
}

.avatar-video-container {
    z-index: 10;
    position: absolute;
    width: 100%;
    height: 100%;
}

.avatar-video-container video,
.avatar-video-container iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: bottom;
    display: block;
    transform: translateZ(0);
    /* Fix for potential flickering */
    backface-visibility: hidden;
}

.gradient-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 15%;
    width: 100%;
    z-index: 20;
    background: linear-gradient(to top, white, transparent);
}

/* Bottom Interface */
.bottom-interface {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    bottom: 0;
    left: 0;
    z-index: 20;
    padding: 6%;
    width: 100%;
    box-sizing: border-box;
    /* Ensure padding doesn't overflow */
}

@media (min-width: 768px) {
    .bottom-interface {
        align-items: flex-start;
    }
}

.gpt-button-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
    max-width: 493px;
}

.gpt-btn {
    border-radius: 30px;
    background: #F3F3F3;
    padding: 0 12px;
    display: flex;
    align-items: center;
    height: 36px;
    width: 100%;
    max-width: 50%;
    cursor: pointer;
    border: none;
}

@media (min-width: 768px) {
    .gpt-btn {
        width: fit-content;
    }
}

.gpt-btn:hover {
    background: #e5e5e5;
}

.gpt-text {
    font-size: 0.875rem;
    font-weight: bold;
    margin: 0 6px;
    white-space: nowrap;
}

/* Chat Form */
.chat-form {
    background: rgba(237, 237, 237, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30px;
    padding-left: 18px;
    padding-right: 8px;
    max-width: 493px;
    height: 52px;
    width: 100%;
}

.chat-input {
    outline: none;
    color: black;
    width: 100%;
    background: transparent;
    border: none;
    font-size: 16px;
}

.chat-input::placeholder {
    color: #6b7280;
}

.send-btn {
    display: flex;
    border-radius: 50%;
    min-width: 34px;
    width: 34px;
    height: 34px;
    background: black;
    color: white;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    border: none;
    cursor: pointer;
}

.send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.init-btn-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem 2rem;
    background: black;
    color: white;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 50;
}

.init-btn-overlay:hover {
    opacity: 0.9;
}

.loader {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 2px solid #fff;
    width: 12px;
    height: 12px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.mic-btn {
    display: flex;
    border-radius: 50%;
    min-width: 34px;
    width: 34px;
    height: 34px;
    background: #e5e7eb;
    color: black;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.mic-btn:hover {
    background: #d1d5db;
}

.mic-btn:active {
    background: #9ca3af;
}

.mic-btn.active {
    background: #fee2e2;
    color: red;
    border: 1px solid red;
}

.status-text {
    margin-left: 10px;
    font-size: 0.8rem;
    color: red;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* --- Token Popup Styles --- */

#token-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    /* Flex but hidden via JS class if needed, or JS will toggle visibility */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    visibility: hidden;
    /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s;
}

#token-popup-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.popup-modal {
    background-color: white;
    border-radius: 1rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 28rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    font-family: 'Inter', sans-serif;
}

.popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    margin-top: 0;
}

.popup-description {
    color: #4b5563;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.popup-input-field {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    outline: none;
    box-sizing: border-box;
}

.popup-input-field:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.popup-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.popup-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

.popup-btn-cancel {
    color: #4b5563;
    background-color: transparent;
}

.popup-btn-cancel:hover {
    background-color: #f3f4f6;
}

.popup-btn-submit {
    background-color: black;
    color: white;
}

.popup-btn-submit:hover {
    opacity: 0.8;
}

.popup-btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}