/**
 * Lesson Generator Overlay Styles
 *
 * Styles for the streaming overlay and developer panel.
 *
 * @package    Lesson_Generator
 * @subpackage Lesson_Generator/assets/css
 * @since      2026-01-27.1
 */

/* Overlay backdrop */
.lg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lg-fadeIn 0.3s ease;
}

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

/* Prevent body scroll when overlay is active */
body.lg-overlay-active {
    overflow: hidden;
}

/* Overlay content card */
.lg-overlay__content {
    background: #fff;
    border-radius: 8px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.lg-overlay__title {
    margin: 0 0 20px;
    font-size: 24px;
    color: #1e1e1e;
}

.lg-overlay__status {
    /* Screen reader only */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.lg-overlay__phase {
    font-size: 18px;
    color: #555;
    margin-bottom: 30px;
}

/* Sections list */
.lg-overlay__sections {
    text-align: left;
    margin-bottom: 30px;
}

/* Planning spinner (shown before sections are known) */
.lg-overlay__planning-spinner {
    width: 50px;
    height: 50px;
    margin: 20px auto;
    border: 4px solid #e0e0e0;
    border-top-color: #1976d2;
    border-radius: 50%;
    animation: lg-spin 1s linear infinite;
}

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

.lg-overlay__section {
    padding: 10px 15px;
    margin: 5px 0;
    border-radius: 4px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lg-overlay__section--pending {
    background: #f5f5f5;
    color: #888;
}

.lg-overlay__section--streaming {
    background: #e3f2fd;
    color: #1976d2;
}

.lg-overlay__section--complete {
    background: #e8f5e9;
    color: #2e7d32;
}

.lg-overlay__section--failed {
    background: #ffebee;
    color: #c62828;
}

.lg-overlay__section--retrying {
    background: #fff3e0;
    color: #ef6c00;
}

/* Icons */
.lg-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
}

.lg-icon--spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #1976d2;
    border-top-color: transparent;
    border-radius: 50%;
    animation: lg-spin 1s linear infinite;
}

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

.lg-icon--check {
    color: #2e7d32;
    font-weight: bold;
}

.lg-icon--error {
    color: #c62828;
    font-weight: bold;
}

/* Cancel button - styled to match site aesthetic */
.lg-overlay__cancel {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: 2px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lg-overlay__cancel:hover {
    color: #333;
    border-color: #999;
    background: #f5f5f5;
}

.lg-overlay__cancel:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.lg-overlay__cancel-warning {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    margin-bottom: 5px;
}

/* Retry modal */
.lg-overlay__retry-modal h3 {
    margin: 0 0 15px;
    color: #ef6c00;
}

.lg-overlay__retry-modal ul {
    text-align: left;
    margin: 0 0 20px;
    padding-left: 20px;
}

.lg-overlay__button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.lg-overlay__button-group .button {
    flex: 0 0 auto;
}

/* Developer panel toggle button */
.lg-dev-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    background: #1976d2;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lg-dev-toggle:hover {
    background: #1565c0;
}

/* Developer panel */
.lg-dev-panel {
    position: fixed;
    top: 50px;
    right: 20px;
    width: 400px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 99998;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lg-dev-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #1976d2;
    color: #fff;
}

.lg-dev-panel__header h3 {
    margin: 0;
    font-size: 14px;
}

.lg-dev-panel__close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.lg-dev-panel__section {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    overflow-y: auto;
    max-height: 200px;
}

.lg-dev-panel__section h4 {
    margin: 0 0 10px;
    font-size: 12px;
    text-transform: uppercase;
    color: #888;
}

.lg-dev-panel__section p {
    margin: 5px 0;
    font-size: 13px;
}

.lg-dev-panel__section ul {
    margin: 5px 0;
    padding-left: 20px;
    font-size: 13px;
}

/* Timing bars */
.lg-dev-panel__timing-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
    font-size: 12px;
}

.lg-dev-panel__timing-label {
    width: 80px;
    flex-shrink: 0;
}

.lg-dev-panel__timing-progress {
    flex: 1;
    height: 16px;
    background: #eee;
    border-radius: 8px;
    overflow: hidden;
}

.lg-dev-panel__timing-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.lg-dev-panel__timing-fill--pending {
    background: #bbb;
}

.lg-dev-panel__timing-fill--streaming {
    background: #1976d2;
    animation: lg-pulse 1s ease infinite;
}

@keyframes lg-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.lg-dev-panel__timing-fill--complete {
    background: #4caf50;
}

.lg-dev-panel__timing-fill--failed {
    background: #f44336;
}

.lg-dev-panel__timing-value,
.lg-dev-panel__timing-tokens {
    width: 60px;
    text-align: right;
    font-size: 11px;
    color: #666;
}

/* Stream log */
#lg-dev-stream {
    font-family: monospace;
    font-size: 11px;
    max-height: 150px;
}

.lg-dev-panel__stream-entry {
    padding: 2px 0;
    border-bottom: 1px solid #f5f5f5;
    word-break: break-all;
}

/* My Lessons badges for partial/generating status */
.lg-lesson-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.lg-lesson-badge--generating {
    background: #e3f2fd;
    color: #1976d2;
}

.lg-lesson-badge--partial {
    background: #fff3e0;
    color: #ef6c00;
}

.lg-lesson-badge--failed {
    background: #ffebee;
    color: #c62828;
}

/* Hide action buttons for incomplete lessons */
.lg-lesson--incomplete .lg-action-print,
.lg-lesson--incomplete .lg-action-pdf,
.lg-lesson--incomplete .lg-action-copy {
    display: none !important;
}

/* Lesson page view mode - semi-transparent to show content generating behind */
.lg-overlay--lesson-view {
    background: rgba(0, 0, 0, 0.7);
}

.lg-overlay--lesson-view .lg-overlay__content {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
