/* Whiteboards Index Styles */
.whiteboards-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.whiteboards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.whiteboard-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.whiteboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.whiteboard-thumbnail {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e0e0e0;
}

.whiteboard-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-thumbnail {
    font-size: 4rem;
    color: #ccc;
}

.whiteboard-info {
    padding: 1.25rem;
}

.whiteboard-info h3 {
    font-size: 1.125rem;
    margin: 0 0 0.5rem 0;
    color: #1a1a1a;
    font-weight: 600;
}

.whiteboard-description {
    font-size: 0.875rem;
    color: #666;
    margin: 0 0 0.75rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.whiteboard-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.813rem;
    color: #888;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.whiteboard-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.whiteboard-card:hover .whiteboard-actions {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.empty-state p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Whiteboard Editor Styles */
.whiteboard-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
}

.whiteboard-toolbar {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toolbar-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e0e0e0;
}

.color-picker {
    width: 40px;
    height: 32px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
}

.active-users {
    display: flex;
    gap: 0.25rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.canvas-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background: white;
}

#whiteboardCanvas {
    display: block;
    cursor: crosshair;
    background: white;
    min-width: 100%;
    min-height: 100%;
}

#whiteboardCanvas.panning {
    cursor: grab;
}

#whiteboardCanvas.panning:active {
    cursor: grabbing;
}

/* Selection and manipulation styles */
.element-selected {
    outline: 2px dashed #667eea;
    outline-offset: 2px;
}

.selection-box {
    position: absolute;
    border: 2px solid #667eea;
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.2);
    pointer-events: none;
    z-index: 1000;
}

.selection-box.multi-selection {
    border-style: dashed;
    background: rgba(102, 126, 234, 0.05);
}

.selection-count {
    position: absolute;
    top: -24px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: auto;
    z-index: 1001;
}

.resize-handle:hover {
    background: #5568d3;
    transform: scale(1.2);
}

.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.resize-handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-handle.e { top: 50%; right: -5px; transform: translateY(-50%); cursor: e-resize; }
.resize-handle.w { top: 50%; left: -5px; transform: translateY(-50%); cursor: w-resize; }

.rotation-handle {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    cursor: grab;
    pointer-events: auto;
    z-index: 1001;
}

.rotation-handle:hover {
    background: #5568d3;
    transform: translateX(-50%) scale(1.1);
}

.rotation-handle:active {
    cursor: grabbing;
}

.multi-select-rect {
    position: absolute;
    border: 2px dashed #667eea;
    background: rgba(102, 126, 234, 0.1);
    pointer-events: none;
    z-index: 998;
}

/* Live preview styles */
.preview-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 999;
}

.preview-shape {
    stroke-dasharray: 5, 5;
    opacity: 0.6;
}

.preview-connector {
    stroke-dasharray: 5, 5;
    opacity: 0.6;
}

.cursor-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    transition: transform 0.1s ease-out;
}

.remote-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 1001;
    transition: transform 0.15s ease-out;
}

.remote-cursor-pointer {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--cursor-color, #3b82f6);
    transform-origin: top center;
}

.remote-cursor-label {
    position: absolute;
    top: 14px;
    left: 8px;
    background: var(--cursor-color, #3b82f6);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: cursorLabelFadeIn 0.3s ease-out;
}

@keyframes cursorLabelFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editing-indicator {
    position: absolute;
    pointer-events: none;
    border: 2px solid var(--cursor-color, #3b82f6);
    border-radius: 4px;
    animation: editingPulse 2s ease-in-out infinite;
    z-index: 999;
}

@keyframes editingPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

.user-avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--cursor-color, #3b82f6);
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--cursor-color, #3b82f6);
}

.user-avatar-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.active-users-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    max-width: 200px;
    z-index: 1002;
}

.active-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.active-user-item:hover {
    background: #f5f5f5;
}

.active-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--user-color, #3b82f6);
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--user-color, #3b82f6);
}

.active-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.active-user-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-editing-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--user-color, #3b82f6);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Mobile Optimization Styles */
@media (max-width: 768px) {
    /* Mobile toolbar */
    .whiteboard-toolbar {
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .toolbar-group {
        gap: 0.25rem;
    }

    .toolbar-btn {
        min-width: 40px;
        height: 40px;
        font-size: 16px;
        padding: 0.5rem;
    }

    .toolbar-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 60px;
        left: 10px;
        right: 10px;
        max-width: none;
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Mobile canvas container */
    .canvas-container {
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Hide layer panel on mobile by default */
    .layer-panel {
        position: fixed;
        top: 60px;
        right: 0;
        bottom: 60px;
        width: 100%;
        max-width: 300px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1100;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
    }

    .layer-panel.show {
        transform: translateX(0);
    }

    /* Mobile comments panel */
    .comments-panel {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 60px;
        width: 100%;
        max-width: 300px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1100;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    }

    .comments-panel.show {
        transform: translateX(0);
    }

    /* Hide active users panel on mobile */
    .active-users-panel {
        display: none;
    }

    /* Mobile modals */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    /* Mobile status bar */
    .whiteboard-statusbar {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        flex-wrap: wrap;
    }

    .status-item {
        font-size: 0.75rem;
    }

    /* Larger touch targets for selection handles */
    .resize-handle {
        width: 20px;
        height: 20px;
    }

    .rotation-handle {
        width: 32px;
        height: 32px;
    }

    /* Mobile-friendly color picker */
    .color-picker {
        width: 40px;
        height: 40px;
    }

    /* Zoom controls for mobile */
    .zoom-controls {
        position: fixed;
        bottom: 70px;
        right: 10px;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        z-index: 1000;
    }

    .zoom-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: white;
        border: 2px solid #ddd;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        transition: all 0.2s;
    }

    .zoom-btn:active {
        transform: scale(0.95);
        background: #f0f0f0;
    }

    /* Touch feedback */
    .toolbar-btn:active,
    .btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    /* Hide keyboard shortcuts hint on mobile */
    .keyboard-hint {
        display: none;
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .toolbar-btn {
        min-width: 36px;
        height: 36px;
    }

    .layer-panel {
        width: 240px;
    }

    .comments-panel {
        width: 280px;
    }

    .active-users-panel {
        max-width: 180px;
    }
}

/* Touch device specific */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .toolbar-btn,
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .toolbar-btn:hover,
    .btn:hover {
        transform: none;
    }

    /* Use active state instead */
    .toolbar-btn:active,
    .btn:active {
        transform: scale(0.95);
    }

    /* Larger selection handles */
    .resize-handle {
        width: 24px;
        height: 24px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .whiteboard-toolbar {
        padding: 0.25rem 0.5rem;
    }

    .toolbar-btn {
        min-width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .modal-dialog {
        max-height: 90vh;
    }
}

/* Cursor label styles (legacy support) */
.cursor-label {
    background: #667eea;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Element Text Editor Styles */
.element-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.element-editor-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    transform: translate(-50%, -50%);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.element-editor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.editor-title {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-formatting-tools {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.editor-formatting-tools .btn {
    padding: 0.25rem 0.5rem;
}

.element-editor-body {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.element-editor-textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.938rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s, background-color 0.2s;
}

.element-editor-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.note-color-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.note-color-option {
    width: 32px;
    height: 32px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.note-color-option:hover {
    transform: scale(1.1);
    border-color: #667eea;
}

.note-color-option:active {
    transform: scale(0.95);
}

.element-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    background: #f9fafb;
}

.element-editor-footer .text-muted {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Rich text preview */
.rich-text-preview {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.rich-text-preview strong,
.rich-text-preview b {
    font-weight: 700;
}

.rich-text-preview em,
.rich-text-preview i {
    font-style: italic;
}

.rich-text-preview u {
    text-decoration: underline;
}

.rich-text-preview ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

/* Double-click hint */
.element-editable-hint {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.element-editable:hover .element-editable-hint {
    opacity: 1;
}

/* Version Comparison Styles */
.version-comparison-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.version-comparison-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.comparison-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comparison-controls {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid #e0e0e0;
}

.version-selector {
    flex: 1;
}

.comparison-arrow {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.comparison-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.summary-stat strong {
    font-size: 1.5rem;
    font-weight: 700;
}

.comparison-content {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    gap: 2rem;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.comparison-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pane-title {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.version-preview {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-style: italic;
}

.version-metadata {
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
}

.comparison-divider {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.changes-list {
    padding: 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e0e0e0;
    max-height: 300px;
    overflow-y: auto;
}

.changes-title {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.change-section {
    margin-bottom: 1.5rem;
}

.change-section-title {
    font-size: 0.938rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.change-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.change-item {
    padding: 0.75rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.change-added {
    background: #d1fae5;
    border-left: 4px solid #10b981;
}

.change-modified {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.change-removed {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.change-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-left: auto;
}

.change-property {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.comparison-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 2px solid #e0e0e0;
    background: white;
}

/* Offline Mode & PWA Styles */
.offline-indicator {
    position: fixed;
    top: 60px;
    right: 20px;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1100;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.offline-indicator.online {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #10b981;
}

.offline-indicator.offline {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #ef4444;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.offline-indicator .pending-badge {
    background: #dc2626;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

.update-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.update-content .bi {
    font-size: 1.5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.btn-close-banner {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0.25rem;
    transition: opacity 0.2s;
}

.btn-close-banner:hover {
    opacity: 0.8;
}

.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    z-index: 1100;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.install-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.install-icon .bi {
    font-size: 2rem;
    color: white;
}

.install-text {
    flex: 1;
}

.install-text h6 {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.install-text p {
    margin: 0;
    font-size: 0.875rem;
    color: #666;
}

.install-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sync-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1100;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.sync-toast.sync-success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #10b981;
}

.sync-toast.sync-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #ef4444;
}

.sync-toast.sync-info {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #3b82f6;
}

.sync-toast.sync-warning {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #f59e0b;
}

.offline-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #666;
}

.sync-indicator .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mobile adjustments for offline UI */
@media (max-width: 768px) {
    .offline-indicator {
        top: 10px;
        right: 10px;
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .update-banner {
        padding: 0.75rem;
    }

    .update-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .pwa-install-prompt {
        bottom: 10px;
        padding: 1rem;
    }

    .install-content {
        flex-direction: column;
        text-align: center;
    }

    .install-actions {
        width: 100%;
    }

    .install-actions button {
        width: 100%;
    }
}

/* Search and Navigation Styles */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: fadeIn 0.2s ease;
}

.search-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: #667eea;
    font-size: 1.25rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 3rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.btn-clear-search {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-clear-search:hover {
    color: #667eea;
}

.btn-close-search {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.btn-close-search:hover {
    color: #667eea;
}

.search-filters {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: white;
    color: #666;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.filter-chip.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: #667eea;
}

.results-header {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 1rem;
    font-weight: 600;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.search-result-item:hover {
    background: #f0f4ff;
    transform: translateX(4px);
}

.result-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-title mark {
    background: #fef3c7;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
}

.result-details {
    font-size: 0.875rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-type {
    padding: 0.125rem 0.5rem;
    background: #e0e0e0;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.result-separator {
    color: #ddd;
}

.result-description {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-favorite {
    background: none;
    border: 1px solid #ddd;
    color: #999;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-favorite:hover {
    border-color: #fbbf24;
    color: #fbbf24;
}

.btn-favorite.active {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #f59e0b;
}

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: #666;
}

.search-suggestions {
    padding: 1rem 0;
}

.search-suggestions h6 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.75rem;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-item:hover {
    background: #f0f4ff;
}

.suggestion-item .bi {
    color: #667eea;
    font-size: 1.25rem;
}

.search-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    background: #f9fafb;
}

.search-footer kbd {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    margin: 0 0.25rem;
}

.results-footer {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-size: 0.875rem;
    border-top: 1px solid #e0e0e0;
    margin-top: 1rem;
}

/* Mobile adjustments for search */
@media (max-width: 768px) {
    .search-overlay {
        padding-top: 5vh;
    }

    .search-panel {
        width: 95%;
        max-height: 85vh;
    }

    .search-header {
        padding: 1rem;
    }

    .search-filters {
        padding: 0.75rem 1rem;
    }

    .search-results {
        padding: 0.75rem 1rem;
    }

    .search-result-item {
        padding: 0.75rem;
    }

    .result-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Group selection and manipulation */
.group-selection-box {
    border: 2px dashed #667eea;
    background: rgba(102, 126, 234, 0.05);
    pointer-events: none;
}

.group-handle {
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid #667eea;
    cursor: pointer;
    position: absolute;
}

.group-handle:hover {
    transform: scale(1.2);
    background: #667eea;
}

.group-handle.nw { cursor: nwse-resize; }
.group-handle.n { cursor: ns-resize; }
.group-handle.ne { cursor: nesw-resize; }
.group-handle.e { cursor: ew-resize; }
.group-handle.se { cursor: nwse-resize; }
.group-handle.s { cursor: ns-resize; }
.group-handle.sw { cursor: nesw-resize; }
.group-handle.w { cursor: ew-resize; }

.group-rotation-handle {
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: grab;
    position: absolute;
}

.group-rotation-handle:active {
    cursor: grabbing;
}

.group-rotation-line {
    width: 2px;
    background: #667eea;
    opacity: 0.5;
    position: absolute;
}

.group-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.group-operations {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    position: absolute;
    z-index: 1000;
}

.group-operation-btn {
    padding: 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-operation-btn:hover {
    background: #f0f0f0;
    border-color: #667eea;
    transform: translateY(-1px);
}

.group-operation-btn:active {
    transform: translateY(0);
}

.group-locked-indicator {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    pointer-events: none;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Group movement cursor */
.cursor-group-move {
    cursor: move !important;
}

.cursor-group-resize-nw { cursor: nwse-resize !important; }
.cursor-group-resize-n { cursor: ns-resize !important; }
.cursor-group-resize-ne { cursor: nesw-resize !important; }
.cursor-group-resize-e { cursor: ew-resize !important; }
.cursor-group-resize-se { cursor: nwse-resize !important; }
.cursor-group-resize-s { cursor: ns-resize !important; }
.cursor-group-resize-sw { cursor: nesw-resize !important; }
.cursor-group-resize-w { cursor: ew-resize !important; }
.cursor-group-rotate { cursor: grab !important; }
.cursor-group-rotate:active { cursor: grabbing !important; }

/* Mobile adjustments for comparison */
@media (max-width: 1024px) {
    .comparison-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .comparison-divider {
        display: none;
    }

    .comparison-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile adjustments for editor */
@media (max-width: 768px) {
    .element-editor-container {
        width: 95%;
        max-height: 90vh;
    }

    .editor-formatting-tools {
        flex-wrap: wrap;
    }

    .element-editor-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .element-editor-footer > div {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .comparison-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .comparison-arrow {
        transform: rotate(90deg);
        margin: 0.5rem 0;
    }

    .comparison-summary {
        grid-template-columns: 1fr 1fr;
    }

    .comparison-footer {
        flex-direction: column;
    }

    .comparison-footer .ms-auto {
        margin-left: 0 !important;
        width: 100%;
    }
}

/* Grid overlay styles */
.grid-overlay {
    pointer-events: none;
    z-index: 1;
}

.whiteboard-statusbar {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.813rem;
    color: #666;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #f5f5f5;
}

/* Layer Panel Styles */
.layer-panel {
    position: fixed;
    right: 20px;
    top: 80px;
    width: 280px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

.layer-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.layer-panel-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.layer-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.layer-item {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.layer-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.layer-item.active {
    background: #e7f0ff;
    border-color: #667eea;
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.layer-icon {
    color: #667eea;
    font-size: 14px;
}

.layer-name {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-actions {
    display: flex;
    gap: 4px;
}

.layer-actions .btn {
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Keyboard Shortcuts Modal Styles */
.modal kbd {
    padding: 2px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f8f9fa;
    font-family: monospace;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.modal .table td:first-child {
    width: 40%;
    font-weight: 500;
}

/* Group Item Styles */
.group-item {
    background: #f0f4ff;
    border-color: #667eea;
}

.group-item:hover {
    background: #e7f0ff;
}

.group-item.active {
    background: #d4e4ff;
    border-color: #4c63d2;
}

/* Presentation Mode Styles */
.presentation-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.presentation-exit {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.presentation-exit:hover {
    opacity: 1;
}

.presentation-canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.presentation-canvas-container canvas {
    max-width: 95vw;
    max-height: 95vh;
    background: white;
    box-shadow: 0 0 50px rgba(255,255,255,0.1);
}

.presentation-controls {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.9);
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.presentation-controls .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Comments Panel Styles */
.comments-panel {
    position: fixed;
    left: 20px;
    top: 80px;
    width: 320px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.comments-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.comments-panel-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.comments-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f8f9fa;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.comment-date {
    font-size: 11px;
    color: #666;
}

.comment-content {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
}

.comment-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.comment-actions .btn {
    font-size: 11px;
    padding: 2px 8px;
}

.comment-item.resolved {
    opacity: 0.6;
    background: #f0f0f0;
}

.comment-resolved-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 11px;
}

/* Comment Threading */
.comment-thread {
    margin-bottom: 16px;
}

.comment-replies {
    margin-left: 24px;
    margin-top: 8px;
    border-left: 2px solid #e0e0e0;
    padding-left: 12px;
}

.comment-reply {
    margin-bottom: 8px;
    background: #f8f8f8;
}

.comment-toggle-replies {
    font-size: 11px;
    padding: 2px 8px;
    margin-top: 4px;
}

.edit-comment-area textarea {
    font-size: 13px;
}

.comment-item.editing {
    background: #fffbea;
    border-color: #ffc107;
}

/* Task Integration */
.task-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #fff;
    border: 2px solid #0d6efd;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    white-space: nowrap;
    max-width: 200px;
}

.task-badge.completed {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.task-badge.high-priority {
    border-color: #dc3545;
    background: #fff5f5;
}

.task-badge-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-badge .bi {
    font-size: 12px;
}

/* Responsive Styles */
@media (max-width: 768px) {
        .whiteboards-grid {
            grid-template-columns: 1fr;
        }

        .whiteboard-toolbar {
            flex-direction: column;
            align-items: stretch;
        }

        .toolbar-section {
            justify-content: space-between;
        }
    }

    /* Recording Indicator Styles */
    .recording-indicator {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.25rem 0.75rem;
        background: rgba(220, 53, 69, 0.1);
        border-radius: 4px;
        font-size: 0.875rem;
        font-weight: 600;
        color: #dc3545;
    }

    .recording-pulse {
        animation: recording-pulse 1.5s infinite;
    }

    @keyframes recording-pulse {
        0%, 100% {
            opacity: 1;
        }
        50% {
            opacity: 0.4;
        }
    }
