* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    overflow: hidden;
    background: #f8f9fa;
    color: #333;
}

header {
    height: 50px;
    background: #2c3e50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
    position: relative;
}

.course-title {
    font-size: 18px;
    font-weight: bold;
}

.header-actions button {
    margin-left: 5px;
    padding: 6px 12px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background: #34495e;
    color: white;
    font-size: 14px;
    transition: background 0.2s;
}

.header-actions button:hover {
    background: #456280;
}

.header-actions button.primary {
    background: #e74c3c;
    font-weight: bold;
    margin-left: 20px;
}

.header-actions button.primary:hover {
    background: #c0392b;
}

main {
    position: relative;
    width: 100vw;
    height: calc(100vh - 50px);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: white;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 20;
}

.toolbar button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.toolbar button:hover {
    background: #f1f2f6;
}

.toolbar button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

#context-menu {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
    padding: 5px 0;
    z-index: 100;
    border-radius: 4px;
    min-width: 150px;
}

#context-menu.hidden {
    display: none;
}

#context-menu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

#context-menu button:hover {
    background: #f0f0f0;
}

/* Session badge */
.session-badge {
    font-size: 14px;
    color: #e74c3c;
    margin-left: 15px;
    animation: pulse 1.5s infinite;
}

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

.hidden {
    display: none !important;
}

/* Danger button (end class) */
.header-actions button.danger {
    background: #e74c3c;
    font-weight: bold;
    margin-left: 20px;
}

.header-actions button.danger:hover {
    background: #c0392b;
}

/* Dialog overlay */
.dialog-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog-box {
    background: white;
    border-radius: 12px;
    padding: 30px;
    min-width: 360px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.dialog-box h3 {
    margin-bottom: 10px;
    font-size: 20px;
    color: #2c3e50;
}

.dialog-box p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.dialog-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.dialog-box.large {
    width: 800px;
    max-width: 95vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.library-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 20px;
}

.library-sidebar {
    width: 250px;
    border-right: 1px solid #eee;
    padding-right: 15px;
    display: flex;
    flex-direction: column;
}

.library-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.folder-actions, .course-actions {
    margin-bottom: 15px;
}

#folder-tree {
    list-style: none;
    padding-left: 0;
    overflow-y: auto;
}

#folder-tree li {
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
}

#folder-tree li:hover {
    background-color: #f5f5f5;
}

#folder-tree li.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: bold;
}

.course-card {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.course-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.course-info h4 {
    margin: 0 0 5px;
}

.course-info p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.error-msg {
    color: #d32f2f;
    margin-top: -15px;
    margin-bottom: 15px;
    font-size: 14px;
}

.dialog-box input:focus {
    border-color: #3498db;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.dialog-actions button {
    padding: 8px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    background: white;
}

.dialog-actions button.primary {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.dialog-actions button.primary:hover {
    background: #2980b9;
}

/* Replay Player Styles */
.playback-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 10px 25px;
    border-radius: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 20;
    width: 80%;
    max-width: 800px;
}

.playback-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #3498db;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

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

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

.playback-time {
    font-size: 14px;
    font-weight: bold;
    color: #555;
    min-width: 100px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.scrubber {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    transition: transform 0.1s;
}

.scrubber::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.speed-selector {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 15px;
    background: white;
    font-size: 14px;
    color: #333;
    outline: none;
    cursor: pointer;
}

/* Lightbox Styles */
#image-lightbox-modal {
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
}

.lightbox-container {
    position: relative;
    width: 85vw;
    height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 36px;
}

.lightbox-canvas-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    background: white;
    touch-action: none;
}

.lightbox-toolbar {
    position: absolute;
    bottom: -60px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.lightbox-toolbar button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.lightbox-toolbar button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

