* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --dark-bg: #0f1419;
    --light-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --success-color: #4caf50;
    --error-color: #f44336;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screen Management */
.screen {
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Home Screen */
#homeScreen {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.home-content {
    text-align: center;
    color: white;
    max-width: 800px;
    padding: 20px;
}

.logo {
    margin-bottom: 50px;
}

.logo h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.logo p {
    font-size: 1.3rem;
    opacity: 0.9;
}

.action-buttons {
    display: flex;
    gap: 20px;
    margin-bottom: 60px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(240, 147, 251, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: #f5f5f5;
}

.btn-tertiary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-tertiary:hover {
    background: white;
    color: var(--primary-color);
}

.btn-block {
    width: 100%;
}

.icon {
    font-size: 1.3rem;
}

/* Features Section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.feature {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.feature h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.feature p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Form Screens */
#createCallScreen,
#joinCallScreen {
    background: var(--light-bg);
}

.form-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.form-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    margin-right: 10px;
    padding: 5px 10px;
    transition: all 0.3s;
}

.back-btn:hover {
    transform: translateX(-2px);
}

.form-header h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Call Screen */
#callScreen {
    background: var(--dark-bg);
    padding: 0;
}

.call-container {
    display: grid;
    grid-template-columns: 1fr;
    height: 100vh;
    gap: 0;
    width: 100%;
}

.call-container.with-side-panel {
    grid-template-columns: minmax(320px, 1fr) 2fr;
}

@media (max-width: 1024px) {
    .call-container {
        grid-template-columns: 1fr;
    }

    .left-panel {
        grid-row: 2;
        max-height: 30vh;
    }
}

/* Left Panel - Transcript, Notes, Summary */
.left-panel {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.left-panel.side-panel-hidden {
    display: none;
}

.panel-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.close-panel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.close-panel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.panel-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.panel-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.panel-tab-content {
    display: none;
}

.panel-tab-content.active {
    display: block;
}

.panel-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.interim-text {
    font-size: 0.85rem;
    color: rgba(240, 147, 251, 0.8);
    font-style: italic;
    min-height: 1.2em;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.control-btn.insights-btn.active {
    background: var(--accent-color);
    box-shadow: 0 0 12px rgba(240, 147, 251, 0.5);
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.2rem;
}

.refresh-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    transition: transform 0.3s;
}

.refresh-btn:hover {
    transform: rotate(180deg);
}

.summary-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.transcript-section,
.summary-section {
    margin-bottom: 30px;
}

.transcript-section h4,
.summary-section h4,
.summary-section h5 {
    margin-bottom: 12px;
    color: var(--accent-color);
    font-size: 1rem;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.notes-section ul,
.final-notes ul {
    list-style: none;
    margin-top: 8px;
}

.notes-section li,
.final-notes li {
    padding: 8px;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.notes-section li:before,
.final-notes li:before {
    content: "•";
    color: var(--accent-color);
    position: absolute;
    left: 0;
}

.final-notes, .final-summary {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
}

.final-notes h3, .final-summary h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.final-notes li, .final-summary li {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 12px 12px 12px 35px;
    margin-bottom: 8px;
    color: #e2e8f0;
    position: relative;
    font-size: 0.95rem;
}

.final-notes li:before, .final-summary li:before {
    content: "✓";
    color: var(--accent-color);
    position: absolute;
    left: 12px;
    font-weight: bold;
}

.message {
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    font-size: 0.9rem;
    line-height: 1.4;
}

.message .speaker {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.summary-text {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 6px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.key-points ul {
    list-style: none;
    margin-top: 8px;
}

.key-points li {
    padding: 8px;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.key-points li:before {
    content: "▸";
    color: var(--accent-color);
    position: absolute;
    left: 0;
}

.placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.9rem;
}

/* Right Panel - Video */
.right-panel {
    background: var(--dark-bg);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.video-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .video-container {
        grid-template-columns: 1fr;
    }
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

.call-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
    color: white;
}

.call-code,
.participant-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.call-code strong,
.participant-count strong {
    font-weight: 600;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.3s;
}

.copy-btn:hover {
    transform: scale(1.2);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.control-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.end-call-btn {
    background: #ff4757;
    border-color: #ff4757;
}

.end-call-btn:hover {
    background: #ff3838;
    border-color: #ff3838;
}

/* Call Ended Screen */
#callEndedScreen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
}

.ended-container {
    max-width: 800px;
    width: 90%;
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.ended-container h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: var(--accent-color);
}

/* The background and styling is now handled by the shared .final-notes, .final-summary block */
.final-transcript {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.final-transcript h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

#finalSummaryText {
    margin-bottom: 15px;
}

#finalTranscript {
    max-height: 250px;
    overflow-y: auto;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Device Check Screen */
#deviceCheckScreen {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.device-check-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.device-check-container h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.device-check-icon {
    font-size: 3rem;
    margin: 20px 0;
}

.device-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    margin: 15px 0;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: left;
}

.device-status-icon {
    font-size: 1.5rem;
}

.device-status.ok .device-status-icon {
    color: var(--success-color);
}

.device-status.error .device-status-icon {
    color: var(--error-color);
}

.device-status-text {
    flex: 1;
}

.device-status-label {
    font-weight: 600;
    color: var(--text-primary);
}

.device-status-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.device-check-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

#loadingText {
    color: white;
    font-size: 1.1rem;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 15px 20px;
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.notification.show {
    opacity: 1;
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--error-color);
    color: white;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-container {
        max-width: 90%;
    }

    .logo h1 {
        font-size: 2.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .video-container {
        grid-template-columns: 1fr;
    }

    .call-info {
        grid-template-columns: 1fr;
    }

    .left-panel {
        max-height: 40vh;
    }
}

/* Beautiful Pulsing Loading Animation for AI insights */
.loading-pulse {
    animation: loadingPulse 1.8s infinite ease-in-out;
    color: rgba(255, 255, 255, 0.75);
    font-style: italic;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px dashed var(--accent-color);
    display: inline-block;
    width: 100%;
}

@keyframes loadingPulse {
    0% {
        opacity: 0.6;
        transform: scale(0.99);
    }
    50% {
        opacity: 1;
        transform: scale(1.0);
    }
    100% {
        opacity: 0.6;
        transform: scale(0.99);
    }
}

