/* Meet Application Styles */

/* Base Layout */
#meetApp {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary, #0f0f0f);
    color: var(--text-primary, #ffffff);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Header */
.meet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary, #1a1a1a);
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    z-index: 100;
}

.meet-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meet-info h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.meeting-id {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    border-radius: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #999);
}

.meeting-timer {
    font-size: 1rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    color: var(--accent-color, #4a9eff);
}

.meet-controls-top {
    display: flex;
    gap: 0.5rem;
}

/* Main Meeting Area */
.meet-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Video Grid */
.video-grid {
    flex: 1;
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-primary, #0f0f0f);
    overflow-y: auto;
}

/* Dynamic grid layouts */
.video-grid:has(.video-container:only-child) {
    grid-template-columns: 1fr;
}

.video-grid:has(.video-container:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

.video-grid:has(.video-container:nth-child(3)),
.video-grid:has(.video-container:nth-child(4)) {
    grid-template-columns: repeat(2, 1fr);
}

.video-grid:has(.video-container:nth-child(5)),
.video-grid:has(.video-container:nth-child(6)) {
    grid-template-columns: repeat(3, 1fr);
}

.video-grid:has(.video-container:nth-child(7)) {
    grid-template-columns: repeat(3, 1fr);
}

/* Video Container */
.video-container {
    position: relative;
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 0.75rem;
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container.local-video {
    border: 2px solid var(--accent-color, #4a9eff);
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participant-name {
    font-size: 0.875rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.video-indicators {
    display: flex;
    gap: 0.5rem;
}

.indicator {
    font-size: 1rem;
    opacity: 1;
    transition: opacity 0.2s;
}

.indicator.muted,
.indicator.off {
    opacity: 0.3;
    text-decoration: line-through;
}

.speaking-indicator {
    position: absolute;
    inset: 0;
    border: 3px solid var(--accent-color, #4a9eff);
    border-radius: 0.75rem;
    pointer-events: none;
    animation: pulse 1s infinite;
}

.speaking-indicator.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Sidebar */
.meet-sidebar {
    width: 360px;
    background: var(--bg-secondary, #1a1a1a);
    border-left: 1px solid var(--border-color, #2a2a2a);
    display: flex;
    flex-direction: column;
}

.sidebar-panel {
    display: none;
    flex-direction: column;
    height: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.panel-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #999);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--text-primary, #fff);
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-actions {
    padding: 1rem;
    border-top: 1px solid var(--border-color, #2a2a2a);
    display: flex;
    gap: 0.5rem;
}

/* Participants List */
.participants-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.participant-item:hover {
    background: var(--bg-tertiary, #2a2a2a);
}

.participant-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.participant-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent-color, #4a9eff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.participant-controls {
    display: flex;
    gap: 0.5rem;
}

/* Chat */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    background: var(--bg-tertiary, #2a2a2a);
    padding: 0.75rem;
    border-radius: 0.5rem;
    max-width: 80%;
}

.chat-message.self {
    align-self: flex-end;
    background: var(--accent-color, #4a9eff);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

.message-content {
    font-size: 0.875rem;
    line-height: 1.4;
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color, #2a2a2a);
}

#chatInput {
    flex: 1;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.send-btn {
    background: var(--accent-color, #4a9eff);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
}

/* Transcription */
.transcription-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.transcription-entry {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    border-radius: 0.5rem;
}

.transcription-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #999);
}

.transcription-text {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Bot Panel */
.bot-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.bot-avatar {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #2a2a2a);
    border-radius: 50%;
}

.bot-name {
    flex: 1;
    font-weight: 500;
}

.bot-state {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-secondary, #999);
}

.bot-state.active {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.bot-commands {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
}

.bot-cmd-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bot-cmd-btn:hover {
    background: var(--accent-color, #4a9eff);
    border-color: var(--accent-color, #4a9eff);
}

.bot-responses {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.bot-response {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    border-radius: 0.5rem;
    border-left: 3px solid var(--accent-color, #4a9eff);
}

.response-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #999);
}

.response-content {
    font-size: 0.875rem;
    line-height: 1.5;
}

.response-content p {
    margin: 0.5rem 0;
}

.loading-dots {
    display: inline-block;
    animation: loading 1.4s infinite;
}

@keyframes loading {
    0%, 60%, 100% { opacity: 1; }
    30% { opacity: 0.3; }
}

/* Screen Share Overlay */
.screen-share-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg-primary, #0f0f0f);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-share-container {
    position: relative;
    width: 90%;
    height: 90%;
}

#screenShareVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.screen-share-controls {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
}

/* Meeting Controls Footer */
.meet-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary, #1a1a1a);
    border-top: 1px solid var(--border-color, #2a2a2a);
    z-index: 100;
}

.controls-left,
.controls-center,
.controls-right {
    display: flex;
    gap: 0.5rem;
}

/* Control Buttons */
.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.control-btn:hover {
    background: var(--bg-hover, #3a3a3a);
}

.control-btn.primary {
    background: var(--bg-tertiary, #2a2a2a);
}

.control-btn.primary.muted,
.control-btn.primary.off {
    background: #f44336;
}

.control-btn.danger {
    background: #f44336;
    border-color: #f44336;
}

.control-btn.danger:hover {
    background: #d32f2f;
}

.control-btn.active {
    background: var(--accent-color, #4a9eff);
    border-color: var(--accent-color, #4a9eff);
}

.control-btn.recording {
    animation: recording-pulse 2s infinite;
}

@keyframes recording-pulse {
    0%, 100% { background: #f44336; }
    50% { background: #d32f2f; }
}

.control-btn .icon {
    font-size: 1.25rem;
}

.control-btn .label {
    font-size: 0.875rem;
}

.control-btn .badge {
    margin-left: 0.25rem;
    padding: 0.125rem 0.375rem;
    background: var(--accent-color, #4a9eff);
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.hidden {
    display: none;
}

/* Action Buttons */
.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--accent-color, #4a9eff);
    border-color: var(--accent-color, #4a9eff);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 1rem;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #999);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

.preview-container {
    background: var(--bg-tertiary, #2a2a2a);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

#previewVideo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.5rem;
    background: #000;
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.preview-btn {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-primary, #0f0f0f);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent-color, #4a9eff);
    color: white;
}

.btn-primary:hover {
    background: #3a8eef;
}

.btn-secondary {
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-primary, #fff);
}

.btn-secondary:hover {
    background: var(--bg-hover, #3a3a3a);
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

/* Copy Container */
.copy-container {
    display: flex;
    gap: 0.5rem;
}

.copy-container input {
    flex: 1;
}

.copy-btn {
    padding: 0.75rem 1rem;
    background: var(--accent-color, #4a9eff);
    border: none;
    color: white;
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

/* Share Buttons */
.share-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.share-btn {
    padding: 0.75rem;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, #3a3a3a);
    color: var(--text-primary, #fff);
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.share-btn:hover {
    background: var(--accent-color, #4a9eff);
    border-color: var(--accent-color, #4a9eff);
}

/* Redirect Handler */
.redirect-handler {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.redirect-content {
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
}

.redirect-content h2 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

.redirect-content p {
    margin: 0.5rem 0;
    color: var(--text-secondary, #999);
}

.redirect-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.redirect-actions .btn {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .meet-header {
        padding: 0.75rem 1rem;
    }

    .meet-info h2 {
        font-size: 1rem;
    }

    .meeting-id,
    .meeting-timer {
        font-size: 0.75rem;
    }

    .video-grid {
        grid-template-columns: 1fr !important;
    }

    .meet-sidebar {
        position: fixed;
        inset: 0;
        width: 100%;
        z-index: 200;
        transform: translateX(100%);
        transition: transform 0.3s;
    }

    .meet-sidebar.active {
        transform: translateX(0);
    }

    .meet-controls {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }

    .control-btn {
        padding: 0.5rem 0.75rem;
    }

    .control-btn .label {
        display: none;
    }

    .modal-content {
        padding: 1.5rem;
    }
}

/* Dark Mode Variables */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-hover: #3a3a3a;
    --border-color: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --accent-color: #4a9eff;
}

/* Light Mode Override */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --bg-hover: #d0d0d0;
    --border-color: #e0e0e0;
    --text-primary: #000000;
    --text-secondary: #666666;
    --accent-color: #2196f3;
}
