/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --panel-bg: rgba(44, 62, 80, 0.9);
    --panel-hover: rgba(52, 73, 94, 0.95);
    --button-hover: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000;
    touch-action: none;
    user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Minimal Header */
.app-header {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-icon {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.btn-icon:hover {
    background: var(--button-hover);
}

/* Main Content - Full Screen Video */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: calc(100vh - 50px); /* Subtract header height */
}

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#videoElement {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center;
    transition: transform 0.3s ease;
}

/* Annotation Canvas */
.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    cursor: crosshair;
    z-index: 10;
}

.annotation-canvas.eraser {
    cursor: grab;
}

.annotation-canvas.text {
    cursor: text;
}

/* Grid Overlay */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 5;
    display: none;
}

.grid-overlay.show {
    display: block;
}

/* Floating Control Panel */
.floating-panel {
    position: absolute;
    top: 70px;
    left: 20px;
    width: 280px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 50;
    transition: var(--transition);
    color: white;
}

.floating-panel.dragging {
    transition: none;
    opacity: 0.8;
}

.panel-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.panel-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-minimize {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: var(--transition);
}

.panel-minimize:hover {
    background: var(--button-hover);
}

.panel-content {
    padding: 1rem;
}

.panel-section {
    margin-bottom: 1rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.panel-section h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.control-select {
    width: 100%;
    padding: 0.4rem;
    margin-bottom: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9rem;
}

.control-select:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.15);
}

.control-select option {
    background: var(--primary-color);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-small:active {
    transform: translateY(0);
}

/* Slider Controls */
.slider-label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    opacity: 0.9;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Floating Drawing Tools */
.floating-tools {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 240px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 50;
    transition: var(--transition);
    color: white;
}

.floating-tools.dragging {
    transition: none;
    opacity: 0.8;
}

.tools-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.tools-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tools-minimize {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: var(--transition);
}

.tools-minimize:hover {
    background: var(--button-hover);
}

.tools-content {
    padding: 1rem;
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    color: white;
    padding: 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tool-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Width Control */
.width-control {
    margin-bottom: 1rem;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.btn-action {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Minimized Buttons */
.minimized-buttons {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 45;
}

.minimized-btn {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.minimized-btn:hover {
    background: var(--panel-hover);
    transform: translateY(-2px);
}

/* No Camera Message */
.no-camera-message {
    display: none;
    text-align: center;
    padding: 2rem;
    color: white;
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--border-radius);
    max-width: 500px;
}

.no-camera-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.no-camera-message p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.video-container.no-camera .no-camera-message {
    display: block;
}

.video-container.no-camera #videoElement,
.video-container.no-camera .annotation-canvas {
    display: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--primary-color);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 450px;
    color: white;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.modal-content.small {
    max-width: 350px;
}

.modal-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--button-hover);
}

.modal-body {
    padding: 1.5rem;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

#textInput {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    margin-bottom: 1rem;
}

#textInput:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.15);
}

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

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Panel Hidden States */
.floating-panel.hidden {
    display: none;
}

.floating-tools.hidden {
    display: none;
}

/* Responsive for Mobile */
@media (max-width: 768px) {
    .floating-panel {
        width: 90%;
        max-width: 320px;
        left: 5%;
    }
    
    .floating-tools {
        width: 90%;
        max-width: 280px;
        right: 5%;
    }
    
    .header-content h1 {
        font-size: 1rem;
    }
    
    .tool-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Touch Device Optimizations */
@media (pointer: coarse) {
    .tool-btn,
    .btn-action,
    .btn-small,
    .color-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Whiteboard Mode Styles */
.whiteboard-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    background: white;
    overflow: hidden;
}

.whiteboard-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    touch-action: none;
    z-index: 21;
}

.whiteboard-drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 30;
    cursor: crosshair;
}

/* Mini Camera Preview */
.mini-camera-preview {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 240px;
    height: 180px;
    background: #000;
    border: 3px solid var(--primary-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.mini-camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.snapshot-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.snapshot-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.snapshot-btn:active {
    transform: scale(0.95);
}

/* Whiteboard Controls */
.whiteboard-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 2rem;
    z-index: 100;
    min-width: calc(100% - 100px); /* Extended width for AI controls */
    max-width: 95%;
}

.wb-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wb-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
}

.wb-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wb-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.wb-btn.wb-exit {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.wb-btn.wb-exit:hover {
    background: #c0392b;
}

.bg-preview {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: inline-block;
}

#wbZoomLevel {
    color: white;
    font-size: 0.9rem;
    min-width: 50px;
    text-align: center;
}

/* Draggable Image Objects */
.whiteboard-image {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    user-select: none;
    touch-action: none;
}

.whiteboard-image.selected {
    border: 2px dashed var(--secondary-color);
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.3);
}

.whiteboard-image .resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--secondary-color);
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
}

.whiteboard-image .resize-handle.tl {
    top: -8px;
    left: -8px;
    cursor: nw-resize;
}

.whiteboard-image .resize-handle.tr {
    top: -8px;
    right: -8px;
    cursor: ne-resize;
}

.whiteboard-image .resize-handle.bl {
    bottom: -8px;
    left: -8px;
    cursor: sw-resize;
}

.whiteboard-image .resize-handle.br {
    bottom: -8px;
    right: -8px;
    cursor: se-resize;
}

.whiteboard-image .rotate-handle {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--success-color);
    border: 2px solid white;
    border-radius: 50%;
    cursor: grab;
}

.whiteboard-image .delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--danger-color);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.whiteboard-image.selected .resize-handle,
.whiteboard-image.selected .rotate-handle,
.whiteboard-image.selected .delete-btn {
    display: flex;
}

/* Whiteboard Background Colors */
.whiteboard-container.bg-white {
    background: white;
}

.whiteboard-container.bg-lightgray {
    background: #f0f0f0;
}

.whiteboard-container.bg-darkgray {
    background: #404040;
}

.whiteboard-container.bg-black {
    background: black;
}

/* Mobile Optimizations for Whiteboard */
@media (max-width: 768px) {
    .mini-camera-preview {
        width: 160px;
        height: 120px;
    }
    
    .whiteboard-controls {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.5rem;
    }
}

/* PWA Install Button Styles */
#installBtn {
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

#installBtn i {
    color: var(--success-color);
}

#installBtn:hover {
    background: rgba(39, 174, 96, 0.2);
}

/* Install button pulse animation */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(39, 174, 96, 0);
    }
}

/* Success message animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Print Styles */
@media print {
    .app-header,
    .floating-panel,
    .floating-tools,
    .minimized-buttons {
        display: none !important;
    }
}
/* AI Teaching Mode Styles */
#aiModeBtn i {
    color: var(--secondary-color);
}

#aiModeBtn.active {
    background: rgba(52, 152, 219, 0.2);
}

.ai-mode-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f7fa;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.ai-mode-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.ai-mode-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.ai-mode-header .btn-icon {
    background: rgba(255,255,255,0.2);
    color: white;
}

.ai-mode-content {
    flex: 1;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    padding: 2rem;
    overflow: auto;
}

.ai-camera-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-camera-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.ai-camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-camera-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ai-camera-select {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ai-camera-select:hover {
    border-color: #764ba2;
}

.ai-camera-select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.1);
}

.ai-snapshot-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-snapshot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ai-snapshot-btn:active {
    transform: translateY(0);
}

.ai-snapshot-btn i {
    margin-right: 0.5rem;
}

.ai-status {
    text-align: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    font-weight: 500;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ai-status.processing {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    color: white;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.ai-content-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    overflow: auto;
}

.ai-content-display {
    min-height: 400px;
}

.ai-welcome {
    text-align: center;
    padding: 3rem 2rem;
}

.ai-welcome i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.ai-welcome h3 {
    color: #2c3e50;
    margin: 1rem 0;
    font-size: 1.8rem;
}

.ai-welcome p {
    color: #7f8c8d;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.ai-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.ai-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: transform 0.2s;
}

.ai-feature:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ai-feature i {
    font-size: 2rem;
    color: #667eea;
}

.ai-feature span {
    font-weight: 600;
    color: #2c3e50;
}

/* AI Generated Content Styles */
.ai-result {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.ai-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-section h3 i {
    color: #667eea;
}

.ai-quiz-question {
    background: white;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: border-color 0.3s;
}

.ai-quiz-question:hover {
    border-color: #667eea;
}

.ai-quiz-option {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.ai-quiz-option:hover {
    background: #e8eaf6;
    border-color: #667eea;
}

.ai-quiz-option.correct {
    background: #d4edda;
    border-color: #28a745;
}

.ai-quiz-option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.ai-vocabulary-card {
    background: white;
    padding: 1rem;
    margin: 0.75rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ai-vocabulary-word {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.ai-activity-card {
    background: white;
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.ai-activity-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.ai-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.ai-loading-text {
    margin-top: 1rem;
    color: #667eea;
    font-weight: 600;
}

/* Responsive AI Mode */
@media (max-width: 968px) {
    .ai-mode-content {
        grid-template-columns: 1fr;
    }
    
    .ai-camera-section {
        max-width: 500px;
        margin: 0 auto;
    }
}

/* Additional AI Mode Styles for Enhanced Content */

.vocab-example {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f4ff;
    border-left: 3px solid #667eea;
    font-size: 0.9rem;
    color: #555;
}

.vocab-hint {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fff8dc;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #666;
}

.vocab-hint i {
    color: #ffc107;
    margin-right: 0.25rem;
}

.activity-goals {
    margin-top: 1rem;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 6px;
}

.activity-goals strong {
    color: #2e7d32;
}

.activity-goals ul {
    margin-top: 0.5rem;
}

.no-content {
    padding: 2rem;
    text-align: center;
    color: #999;
    font-style: italic;
}

.quiz-answer strong:first-child {
    color: #28a745;
}

.quiz-answer {
    margin-top: 1rem;
    padding: 1rem;
    background: #e8f5e9;
    border-left: 4px solid #28a745;
    border-radius: 4px;
}

/* Enhanced Lesson Plan Styling */

.lesson-title {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e7ff;
}

.lesson-meta {
    padding: 0.75rem 1rem;
    background: #f0f4ff;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    color: #555;
}

.lesson-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: white;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.lesson-section h4 {
    color: #667eea;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.lesson-section h4 i {
    margin-right: 0.5rem;
    color: #764ba2;
}

.lesson-steps {
    list-style: decimal;
    padding-left: 1.5rem;
}

.lesson-steps li {
    padding: 0.5rem 0;
    line-height: 1.6;
}

.lesson-list {
    list-style: disc;
    padding-left: 1.5rem;
}

.lesson-list li {
    padding: 0.3rem 0;
    line-height: 1.6;
}

.materials-list li {
    padding-left: 0.5rem;
}

.materials-list li:before {
    content: "✓ ";
    color: #28a745;
    font-weight: bold;
    margin-right: 0.25rem;
}

.discussion-section {
    background: #f8f9ff;
    border-left-color: #5f6fe7;
}

.assessment-section {
    background: #fff8f0;
    border-left-color: #ff9800;
}

.extensions-section {
    background: #f0fff8;
    border-left-color: #28a745;
}

/* AI Enhance Button Styling */

.wb-ai-enhance {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    font-weight: bold;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wb-ai-enhance:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.wb-ai-enhance:active:not(:disabled) {
    transform: translateY(0);
}

.wb-ai-enhance:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.wb-ai-enhance i {
    margin-right: 0.5rem;
}

/* AI Enhancement Level Selector */

.wb-ai-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wb-select {
    padding: 0.5rem;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wb-select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.wb-select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* ========================================
   AI 3D Studio Styles
   ======================================== */

.ai3d-studio-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: grid;
    grid-template-rows: auto 1fr;
    color: white;
}

.ai3d-studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.ai3d-studio-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai3d-studio-header h2 i {
    color: #64b5f6;
}

.ai3d-studio-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    padding: 2rem;
    overflow: hidden;
}

.ai3d-canvas-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai3d-canvas-container {
    position: relative;
    flex: 1;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(100, 181, 246, 0.2);
}

#ai3dCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.ai3d-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.ai3d-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(100, 181, 246, 0.2);
    border-top-color: #64b5f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai3d-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ai3d-control-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(100, 181, 246, 0.1);
    color: #64b5f6;
    border: 2px solid rgba(100, 181, 246, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai3d-control-btn:hover {
    background: rgba(100, 181, 246, 0.2);
    border-color: #64b5f6;
    transform: translateY(-2px);
}

.ai3d-control-btn.active {
    background: #64b5f6;
    color: white;
    border-color: #64b5f6;
}

.ai3d-prompt-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.ai3d-prompt-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #64b5f6;
}

.ai3d-prompt-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.ai3d-prompt-input-container {
    flex: 1;
    min-height: 200px;
}

.ai3d-prompt-input {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(100, 181, 246, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

.ai3d-prompt-input:focus {
    outline: none;
    border-color: #64b5f6;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(100, 181, 246, 0.1);
}

.ai3d-prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.ai3d-generate-btn {
    width: 100%;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.ai3d-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(102, 126, 234, 0.6);
}

.ai3d-generate-btn:active {
    transform: translateY(0);
}

.ai3d-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai3d-examples {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(100, 181, 246, 0.1);
}

.ai3d-examples h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.ai3d-example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai3d-example-chip {
    padding: 0.5rem 1rem;
    background: rgba(100, 181, 246, 0.1);
    color: #64b5f6;
    border: 1px solid rgba(100, 181, 246, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.ai3d-example-chip:hover {
    background: rgba(100, 181, 246, 0.2);
    border-color: #64b5f6;
    transform: translateY(-1px);
}

.ai3d-response-display {
    padding: 1rem;
    background: rgba(100, 181, 246, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(100, 181, 246, 0.2);
}

.ai3d-response-display h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: #64b5f6;
}

.ai3d-response-text {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ai3d-studio-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .ai3d-prompt-section {
        max-height: 50vh;
    }
}
