/* static/styles.css */
@font-face {
    font-family: 'AppFont';
    /* Using a relative path is more reliable */
    src: url('fonts/FUI.woff2') format('woff2');
}

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --dark-gray: #212529;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'AppFont', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--dark-gray);
    font-size: 16px;
}

.app-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem;
}

.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.card h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.btn {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary { background-color: var(--primary-color); color: white; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-download { background-color: #fd7e14; color: white; }
.btn-action { background-color: #6c757d; color: white; margin-top: 1rem; }
.btn:disabled { background-color: #ced4da; cursor: not-allowed; }

/* Editor Layout */
.editor-layout { display: flex; gap: 1.5rem; min-height: 60vh; }
.sidebar { width: 300px; flex-shrink: 0; background: #fff; border: 1px solid var(--border-color); border-radius: 5px; }
.sidebar h3 { padding: 1rem; margin: 0; font-size: 1.1rem; background: var(--light-gray); border-bottom: 1px solid var(--border-color); }
#topic-list { list-style: none; padding: 0; margin: 0; max-height: 55vh; overflow-y: auto; }

#topic-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.topic-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}
.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.2s ease;
    border-radius: 50%;
}
.delete-btn:hover { opacity: 1; }
.delete-btn:focus {
    opacity: 1;
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.delete-btn svg { display: block; width: 32px; height: 32px; }

#topic-list li:hover { background-color: #e9ecef; }
#topic-list li.active { background-color: var(--primary-color); color: white; font-weight: bold; }
#topic-list li.active .delete-btn { opacity: 0.8; }
#topic-list li.active .delete-btn:hover { opacity: 1; }
#topic-list li.active .delete-btn svg path { fill: #fff; }

.main-content { flex-grow: 1; }
.editor-wrapper { flex-grow: 1; display: flex; flex-direction: column; }
#editor-container { display: flex; flex-direction: column; height: 100%; }

/* Status Overlay */
#status-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1000; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; }
.spinner { border: 8px solid #f3f3f3; border-top: 8px solid var(--primary-color); border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; }
#status-text { margin-top: 1rem; font-size: 1.2rem; }
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Course Player & Generated Content Styles --- */
main#content-area {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem 3rem;
    background-color: #ffffff;
    box-shadow: var(--shadow);
    border-radius: 8px;
    box-sizing: border-box;
}

main#content-area img,
main#content-area video,
main#content-area object,
main#content-area iframe {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

main#content-area object {
    min-height: 80vh;
    width: 100%;
}

body > footer#player-footer {
    max-width: 900px;
    margin: -1rem auto 2rem auto;
    padding: 1rem 2rem;
    background-color: #e9ecef;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

/* Labeled Graphic and Flyout Styles */
.labeled-graphic-wrapper { position: relative; margin: 1.5rem 0; }
.labeled-graphic-layer-dot { position: absolute; cursor: pointer; }
.sp-flyout-container { display: none; position: absolute; background: white; border: 1px solid #ccc; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.25); padding: 15px; z-index: 1000; width: 320px; max-height: 450px; overflow-y: auto; transform: translate(30px, -30px); }
.sp-flyout-container.active { display: block; }

/* Image Scaling and Layout Styles */
.flex-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    margin: 0 -5px; /* Offset padding on children */
}
.img-container-50 {
    width: 50%;
    max-width: 50%;
    padding: 5px;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: top;
}
.img-container-100 {
    width: 100%;
}

/* Responsive styles for smaller screens */
@media (max-width: 767px) {
    .flex-row {
        flex-direction: column; /* Stack items vertically */
        margin: 0;
    }
    .img-container-50 {
        width: 100%; /* Make 50% images full-width */
        max-width: 100%;
        padding: 5px 0;
    }
}

/* --- Custom Video Player Styles --- */
.video-container {
    position: relative;
    width: 100%;
    background-color: #000;
    font-family: Arial, sans-serif;
    border-radius: 4px; /* Match image radius */
    overflow: hidden; /* Ensures controls don't stick out */
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background-image: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.video-container.controls-visible .video-controls {
    opacity: 1;
    visibility: visible;
}

.video-controls button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-controls button svg {
    width: 22px;
    height: 22px;
    fill: white;
    pointer-events: none;
}

.time-display, .speed-display {
    font-family: monospace;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.speed-display {
    width: 45px;
    text-align: center;
}

.spacer {
    flex-grow: 1;
}

/* Modern Volume Slider Styling */
input[type="range"].volume-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    width: 100px;
}
input[type="range"].volume-slider:focus {
    outline: none;
}
input[type="range"].volume-slider::-webkit-slider-runnable-track {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 0.5rem;
    height: 0.5rem;
}
input[type="range"].volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -4px;
    background-color: #fff;
    border-radius: 1rem;
    height: 1rem;
    width: 1rem;
}
input[type="range"].volume-slider::-moz-range-track {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 0.5rem;
    height: 0.5rem;
}
input[type="range"].volume-slider::-moz-range-thumb {
    background-color: #fff;
    border: none;
    border-radius: 1rem;
    height: 1rem;
    width: 1rem;
}