/* Avatar Chat Meet-Style Video Call UI CSS - High-Performance Responsive */

/* Overriding default modal styles for the meet layout */
.modal.meet-modal {
    background: #000;
    padding: 0;
    overflow: hidden;
}

.meet-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #202124;
    display: flex;
    flex-direction: column;
    color: #fff;
    font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    position: relative;
}

/* Header */
.meet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 56px;
    box-sizing: border-box;
    flex-shrink: 0;
    background: #202124;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.meet-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meet-logo img {
    height: 32px;
}

.meet-logo span {
    font-size: 0.82rem;
    line-height: 1.15;
    font-weight: 600;
    color: #e8eaed;
}

.meet-presenter-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #3c4043;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #e8eaed;
}

.stop-presenting-btn {
    background: #8ab4f8;
    color: #202124;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.stop-presenting-btn:hover {
    background: #aecbfa;
}

/* Body */
.meet-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 10px 16px;
    gap: 14px;
    box-sizing: border-box;
    min-height: 0;
}

.meet-presentation {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.meet-presentation iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    min-height: 0;
}

.meet-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-shrink: 0;
}

.participant-card {
    background: #3c4043;
    border-radius: 12px;
    flex: 1;
    min-height: 160px;
    max-height: 220px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.participant-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transform: scaleX(-1);
}

.participant-avatar {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    position: relative;
    border: 3px solid transparent;
}

#studentCard .participant-avatar {
    background: #fff;
    padding: 4px;
}

.participant-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 85%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.small-mute-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.small-mute-btn:hover {
    color: #f28b82;
}

.meet-info-panel {
    background: #3c4043;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: #e8eaed;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-row i {
    width: 18px;
    text-align: center;
    color: #9aa0a6;
}

.info-row span {
    font-weight: 500;
}

/* Controls */
.meet-controls {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    flex-shrink: 0;
    background: #202124;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.meet-center-controls {
    display: flex;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.meet-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #3c4043;
    color: #e8eaed;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.meet-btn:hover {
    background: #4a4d51;
}

.meet-btn.muted {
    background: #ea4335;
    color: #fff;
}

.meet-btn.muted:hover {
    background: #d93025;
}

.meet-btn.active {
    background: #8ab4f8;
    color: #202124;
}

.meet-btn.active:hover {
    background: #aecbfa;
}

.hangup-btn {
    width: 58px;
    background: #ea4335;
    color: #fff;
    border-radius: 29px;
}

.hangup-btn:hover {
    background: #d93025;
}

/* Animations */
.speaking-ring {
    position: absolute;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    z-index: 1;
    display: none;
}

.is-speaking .speaking-ring {
    display: block;
    animation: pulseRing 1.5s infinite;
    background: #8ab4f8;
}

.is-thinking .participant-avatar {
    border: 3px solid transparent;
    border-top-color: #8ab4f8;
    border-left-color: #8ab4f8;
    animation: spinBorder 1s linear infinite;
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes spinBorder {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Floating Troubleshoot Drawer / Modal (Available via Info Button) */
.meet-troubleshoot-drawer {
    display: none;
    position: absolute;
    top: 60px;
    right: 20px;
    max-width: 360px;
    width: calc(100% - 40px);
    background: rgba(32, 33, 36, 0.98);
    border: 1px solid #5f6368;
    border-radius: 16px;
    padding: 16px 18px;
    color: #e8eaed;
    font-size: 0.82rem;
    line-height: 1.45;
    box-shadow: 0 16px 36px rgba(0,0,0,0.6);
    z-index: 1000;
    backdrop-filter: blur(12px);
    animation: slideDownFade 0.25s ease-out;
}

.meet-troubleshoot-drawer.open {
    display: block !important;
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === RESPONSIVE DESIGN FOR PORTRAIT MOBILE & TABLETS (max-width: 900px) === */
@media (max-width: 900px) and (orientation: portrait), (max-width: 768px) {
    .meet-header {
        height: 48px;
        padding: 6px 12px;
    }
    
    .meet-logo img {
        height: 26px;
    }
    
    .meet-logo span {
        font-size: 0.72rem;
    }
    
    .meet-presenter-badge {
        display: none;
    }
    
    .meet-body {
        flex-direction: column;
        padding: 6px 8px;
        gap: 8px;
    }
    
    .meet-presentation {
        flex: 1;
        min-height: 0;
        border-radius: 10px;
    }
    
    .meet-sidebar {
        width: 100%;
        flex-direction: row;
        height: auto;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-shrink: 0;
    }
    
    .participant-card {
        min-height: 65px;
        max-height: 75px;
        flex: 1;
        min-width: 100px;
        border-radius: 10px;
    }
    
    .participant-avatar {
        width: 44px;
        height: 44px;
    }
    
    .speaking-ring {
        width: 44px;
        height: 44px;
    }
    
    .participant-label {
        bottom: 4px;
        left: 6px;
        font-size: 0.68rem;
        padding: 2px 6px;
    }
    
    .meet-info-panel {
        display: none;
    }
    
    #meetTroubleshootCard {
        display: none; /* Hidden inline to give 100% space to the lesson; opened via info-btn overlay */
    }
    
    .meet-controls {
        height: 58px;
        padding: 0 8px;
    }
    
    .meet-btn {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }
    
    .hangup-btn {
        width: 50px;
        height: 40px;
    }
}

/* === RESPONSIVE DESIGN FOR LANDSCAPE MOBILE (max-height: 560px) === */
@media (max-height: 560px) and (orientation: landscape) {
    .meet-header {
        height: 36px;
        padding: 2px 10px;
    }
    
    .meet-logo img {
        height: 22px;
    }
    
    .meet-logo span {
        font-size: 0.68rem;
    }
    
    .meet-presenter-badge {
        display: none;
    }
    
    .meet-body {
        flex-direction: row !important;
        padding: 4px 8px;
        gap: 8px;
    }
    
    .meet-presentation {
        flex: 1;
        height: 100%;
        min-height: 0;
        border-radius: 8px;
    }
    
    .meet-sidebar {
        width: 100px !important;
        min-width: 90px;
        max-width: 110px;
        flex-direction: column !important;
        height: 100%;
        gap: 6px;
        overflow-y: auto;
        overflow-x: hidden;
        flex-shrink: 0;
    }
    
    .participant-card {
        min-height: 55px !important;
        max-height: 65px !important;
        height: auto;
        flex: 1;
        border-radius: 8px;
    }
    
    .participant-avatar {
        width: 36px !important;
        height: 36px !important;
    }
    
    .speaking-ring {
        width: 36px !important;
        height: 36px !important;
    }
    
    .participant-label {
        bottom: 2px;
        left: 4px;
        font-size: 0.62rem;
        padding: 1px 4px;
    }
    
    .meet-info-panel {
        display: none !important;
    }
    
    #meetTroubleshootCard {
        display: none !important;
    }
    
    .meet-controls {
        height: 44px;
        padding: 0 8px;
    }
    
    .meet-center-controls {
        gap: 8px;
    }
    
    .meet-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .hangup-btn {
        width: 44px;
        height: 32px;
    }
    
    .meet-troubleshoot-drawer {
        top: 40px;
        max-height: 80vh;
        overflow-y: auto;
    }
}
