* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #202124;
    color: #e8eaed;
    overflow: hidden;
    height: 100vh;
}

/* Join Screen */
.join-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    padding: 20px;
}

.join-card {
    background: white;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.logo-image {
    max-width: 300px;
    height: auto;
    margin: 0 auto 20px auto;
    display: block;
}

.join-subtitle {
    color: #5f6368;
    margin-bottom: 32px;
    font-size: 16px;
}

.input-container {
    margin-bottom: 24px;
    text-align: left;
}

.input-label {
    display: block;
    font-size: 14px;
    color: #5f6368;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-field {
    width: 100%;
    padding: 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    background: #fff;
}

.input-field:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.button-container {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #1557b0;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #5f6368;
    border: 1px solid #dadce0;
}

.btn-secondary:hover {
    background: #f1f3f4;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Waiting Room for participants */
.waiting-room {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    padding: 20px;
}

.waiting-card {
    background: white;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.waiting-title {
    color: #202124;
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 16px;
}

.waiting-subtitle {
    color: #5f6368;
    margin-bottom: 32px;
    font-size: 16px;
}

.waiting-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Admission Control Panel (Host Only) */
.admission-panel {
    position: fixed;
    top: 60px;
    right: -400px;
    width: 400px;
    height: calc(100vh - 140px);
    background: #292a2d;
    border-left: 1px solid #3c4043;
    transition: right 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.admission-panel.open {
    right: 0;
}

.admission-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3c4043;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admission-close-btn {
    background: none;
    border: none;
    color: #e8eaed;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admission-close-btn:hover {
    background: #3c4043;
}

.admission-requests {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

.admission-request {
    background: #3c4043;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.request-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.request-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
}

.request-details {
    color: #e8eaed;
}

.request-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.request-time {
    font-size: 12px;
    color: #9aa0a6;
}

.request-actions {
    display: flex;
    gap: 8px;
}

.request-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.request-btn.admit {
    background: #34a853;
    color: white;
}

.request-btn.admit:hover {
    background: #2d8f47;
}

.request-btn.deny {
    background: #ea4335;
    color: white;
}

.request-btn.deny:hover {
    background: #d23b2d;
}

.no-requests {
    text-align: center;
    color: #9aa0a6;
    font-style: italic;
    padding: 40px 20px;
}

/* Meeting Screen */
.meeting-container {
    display: none;
    height: 100vh;
    background: #202124;
    position: relative;
}

.meeting-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(32, 33, 36, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #3c4043;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.meeting-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    max-height: 40px;
    height: auto;
    width: auto;
}

.meeting-code-badge {
    background: #1a73e8;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.meeting-code-badge:hover {
    background: #1557b0;
}

.participant-count-badge {
    background: #34a853;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.admission-count-badge {
    background: #fbbc04;
    color: #202124;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: none;
}

.admission-count-badge:hover {
    background: #ffa000;
}

.admission-count-badge.has-requests {
    display: inline-block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    background: none;
    border: none;
    color: #e8eaed;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background: #3c4043;
}

/* Video Grid - Dynamic Layout for up to 99 participants */
.video-container {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 80px;
    padding: 16px;
    display: grid;
    gap: 8px;
    transition: all 0.3s ease;
    grid-auto-rows: minmax(200px, 1fr);
}

.video-container.participants-1 {
    grid-template-columns: 1fr;
    place-items: center;
}

.video-container.participants-1 .video-tile {
    max-width: 70%;
    max-height: 70%;
}

.video-container.participants-2 {
    grid-template-columns: 1fr 1fr;
}

.video-container.participants-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.video-container.participants-3 .video-tile:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 50%;
}

.video-container.participants-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.video-container.participants-5,
.video-container.participants-6 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.video-container.participants-7,
.video-container.participants-8,
.video-container.participants-9 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.video-container.participants-10,
.video-container.participants-11,
.video-container.participants-12 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

/* For 13-16 participants */
.video-container.participants-13,
.video-container.participants-14,
.video-container.participants-15,
.video-container.participants-16 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

/* For 17-25 participants */
.video-container.participants-17,
.video-container.participants-18,
.video-container.participants-19,
.video-container.participants-20,
.video-container.participants-21,
.video-container.participants-22,
.video-container.participants-23,
.video-container.participants-24,
.video-container.participants-25 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
}

/* For 26-36 participants */
.video-container.participants-26,
.video-container.participants-27,
.video-container.participants-28,
.video-container.participants-29,
.video-container.participants-30,
.video-container.participants-31,
.video-container.participants-32,
.video-container.participants-33,
.video-container.participants-34,
.video-container.participants-35,
.video-container.participants-36 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

/* For 37-49 participants */
.video-container.participants-37,
.video-container.participants-38,
.video-container.participants-39,
.video-container.participants-40,
.video-container.participants-41,
.video-container.participants-42,
.video-container.participants-43,
.video-container.participants-44,
.video-container.participants-45,
.video-container.participants-46,
.video-container.participants-47,
.video-container.participants-48,
.video-container.participants-49 {
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
}

/* For 50-64 participants */
.video-container.participants-50,
.video-container.participants-51,
.video-container.participants-52,
.video-container.participants-53,
.video-container.participants-54,
.video-container.participants-55,
.video-container.participants-56,
.video-container.participants-57,
.video-container.participants-58,
.video-container.participants-59,
.video-container.participants-60,
.video-container.participants-61,
.video-container.participants-62,
.video-container.participants-63,
.video-container.participants-64 {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
}

/* For 65-81 participants */
.video-container.participants-65,
.video-container.participants-66,
.video-container.participants-67,
.video-container.participants-68,
.video-container.participants-69,
.video-container.participants-70,
.video-container.participants-71,
.video-container.participants-72,
.video-container.participants-73,
.video-container.participants-74,
.video-container.participants-75,
.video-container.participants-76,
.video-container.participants-77,
.video-container.participants-78,
.video-container.participants-79,
.video-container.participants-80,
.video-container.participants-81 {
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
}

/* For 82-99 participants */
.video-container.participants-82,
.video-container.participants-83,
.video-container.participants-84,
.video-container.participants-85,
.video-container.participants-86,
.video-container.participants-87,
.video-container.participants-88,
.video-container.participants-89,
.video-container.participants-90,
.video-container.participants-91,
.video-container.participants-92,
.video-container.participants-93,
.video-container.participants-94,
.video-container.participants-95,
.video-container.participants-96,
.video-container.participants-97,
.video-container.participants-98,
.video-container.participants-99 {
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
}

.video-tile {
    background: #3c4043;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    min-height: 150px;
    aspect-ratio: 16/9;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #3c4043;
}

.video-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.video-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 500;
    color: white;
}

/* Raise Hand Indicator */
.raise-hand-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #fbbc04;
    color: #202124;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: none;
}

.video-tile.raised-hand .raise-hand-indicator {
    display: block;
}

/* Control Bar */
.control-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(32, 33, 36, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #3c4043;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
}

.control-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #3c4043;
    color: #e8eaed;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.control-btn:hover {
    background: #5f6368;
}

.control-btn.active {
    background: #ea4335;
}

.control-btn.mic-off {
    background: #ea4335;
}

.control-btn.camera-off {
    background: #ea4335;
}

.control-btn.recording {
    background: #ea4335;
    animation: pulse 2s infinite;
}

.control-btn.raised-hand {
    background: #fbbc04;
    color: #202124;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.end-call-btn {
    background: #ea4335;
    width: 56px;
    height: 56px;
    margin: 0 16px;
}

.end-call-btn:hover {
    background: #d33b2c;
}

/* Chat Panel with close button */
.chat-panel {
    position: fixed;
    top: 60px;
    right: -400px;
    width: 400px;
    height: calc(100vh - 140px);
    background: #292a2d;
    border-left: 1px solid #3c4043;
    transition: right 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.chat-panel.open {
    right: 0;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3c4043;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-close-btn {
    background: none;
    border: none;
    color: #e8eaed;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn:hover {
    background: #3c4043;
}

.chat-messages {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

.chat-message {
    margin-bottom: 16px;
    padding: 12px;
    background: #3c4043;
    border-radius: 8px;
}

.message-sender {
    font-size: 12px;
    color: #9aa0a6;
    margin-bottom: 4px;
}

.message-text {
    color: #e8eaed;
}

.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid #3c4043;
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #3c4043;
    border-radius: 8px;
    background: #3c4043;
    color: #e8eaed;
    font-size: 14px;
}

.chat-input:focus {
    outline: none;
    border-color: #1a73e8;
}

.send-btn {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.settings-modal.open {
    display: flex;
}

.settings-content {
    background: #292a2d;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #3c4043;
}

.settings-title {
    font-size: 20px;
    font-weight: 500;
}

.settings-close-btn {
    background: none;
    border: none;
    color: #e8eaed;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close-btn:hover {
    background: #3c4043;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #e8eaed;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #3c4043;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-label {
    color: #e8eaed;
    font-size: 14px;
}

.settings-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-select {
    background: #3c4043;
    color: #e8eaed;
    border: 1px solid #5f6368;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
}

.settings-toggle {
    width: 40px;
    height: 20px;
    background: #5f6368;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-toggle.active {
    background: #1a73e8;
}

.settings-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.settings-toggle.active::after {
    transform: translateX(20px);
}

/* Participants Panel */
.participants-panel {
    position: fixed;
    top: 60px;
    right: -350px;
    width: 350px;
    height: calc(100vh - 140px);
    background: #292a2d;
    border-left: 1px solid #3c4043;
    transition: right 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.participants-panel.open {
    right: 0;
}

.participants-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3c4043;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participants-close-btn {
    background: none;
    border: none;
    color: #e8eaed;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.participants-close-btn:hover {
    background: #3c4043;
}

.participants-list {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

.participant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #3c4043;
}

.participant-item:last-child {
    border-bottom: none;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1a73e8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.participant-info {
    flex: 1;
}

.participant-name {
    color: #e8eaed;
    font-weight: 500;
}

.participant-status {
    font-size: 12px;
    color: #9aa0a6;
}

.participant-actions {
    display: flex;
    gap: 8px;
}

.participant-action-btn {
    background: none;
    border: none;
    color: #9aa0a6;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.participant-action-btn:hover {
    background: #3c4043;
    color: #e8eaed;
}

.participant-action-btn.raised-hand {
    color: #fbbc04;
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #34a853;
}

.denial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.denial-content {
    background: white;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.denial-icon {
    font-size: 48px;
    color: #ea4335;
    margin-bottom: 16px;
}

.denial-title {
    font-size: 24px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 12px 0;
}

.denial-message {
    font-size: 16px;
    color: #5f6368;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.denial-ok-btn {
    background: #1a73e8;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.denial-ok-btn:hover {
    background: #1557b0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.notification.error {
    background: #ea4335;
}

.notification.info {
    background: #1a73e8;
}

.notification.warning {
    background: #fbbc04;
    color: #202124;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1a73e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .join-card {
        padding: 32px 24px;
        margin: 20px;
    }
    
    .button-container {
        flex-direction: column;
    }
    
    .chat-panel,
    .participants-panel,
    .admission-panel {
        width: 100%;
        right: -100%;
    }
    
    .meeting-header {
        padding: 0 16px;
    }
    
    .video-container {
        padding: 8px;
    }
    
    .control-bar {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .join-card {
        padding: 24px 16px;
    }
    
    .meeting-info {
        gap: 8px;
    }
    
    .participant-count-badge,
    .meeting-code-badge {
        font-size: 11px;
        padding: 2px 8px;
    }
}