/* Modern Lesson Generator Styles v3.0 - Clean Architecture with Copy as Text
 * Frontend Manager: Centralized asset loading
 * Clean DOM: Separate lesson content from action buttons
 */

/* Base Container */
.lesson-form-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Main form card */
.lesson-form {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 25px;
    transition: transform 900ms ease-in-out, opacity 900ms ease-in-out;
    transform: translateY(0);
    opacity: 1;
    position: relative;
    z-index: 5;
}

/* Header section */
.lesson-form-header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    text-align: center;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.lesson-form-header h2 {
    font-size: 28px;
    margin: 0 0 10px;
    color: white;
}

.lesson-form-header p {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

/* Tabs */
.tab-buttons {
    display: flex;
    margin-bottom: 20px;
    background: #f7f9fc;
    border-radius: 8px;
    padding: 4px;
}

.tab-button {
    flex: 1;
    padding: 12px 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.tab-button:hover {
    color: #2575fc;
}

.tab-button.active {
    background: #2575fc;
    color: white;
}

.tab-content {
    display: none;
    padding: 10px 0;
}

.tab-content.active {
    display: block;
}

/* Form elements */
.lesson-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.lesson-form input[type="text"],
.lesson-form select,
.lesson-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: border-color 0.2s ease;
}

.lesson-form input[type="text"]:focus,
.lesson-form select:focus,
.lesson-form textarea:focus {
    border-color: #2575fc;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

/* File input styling */
.lesson-form .file-input-container {
    position: relative;
    margin-bottom: 20px;
}

.lesson-form .file-input-label {
    display: block;
    background: #f7f9fc;
    border: 2px dashed #cbd5e0;
    border-radius: 6px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lesson-form .file-input-label.highlight {
    border-color: #2196F3;
    background-color: rgba(33, 150, 243, 0.1);
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
}

.lesson-form .file-input-label:hover {
    background: #edf2f7;
    border-color: #2575fc;
}

.lesson-form .file-input-label i {
    font-size: 40px;
    color: #a0aec0;
    margin-bottom: 10px;
    display: block;
}

.lesson-form input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* File Upload and Image Preview Styles */
#multi-image-uploader {
    margin-bottom: 15px;
}

.upload-instructions {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Image preview container */
.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 4px;
    border: 1px dashed #ddd;
}

.image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.image-preview:hover {
    transform: scale(1.05);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview .remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #ff3333;
    border: none;
    padding: 0;
    z-index: 2;
    transition: all 0.2s;
}

.image-preview .remove-image:hover {
    background: rgba(255, 0, 0, 0.8);
    color: white;
    transform: scale(1.1);
}

/* Submit button */
.form-button {
    width: 100%;
    padding: 15px;
    background: #2575fc;
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 500;
    border-radius: 6px;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-button:hover {
    background: #1a66e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Loading state */
.form-button.loading {
    background: #a0aec0;
    pointer-events: none;
}

.form-button.loading::after {
    content: '...';
    display: inline-block;
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Fixed Top Button */
.fixed-button-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 20px;
    padding: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 20;
}

.fixed-top-button {
    width: 100%;
    padding: 15px;
    background: #2575fc;
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: none; /* Initially hidden */
    text-align: center;
    transition: all 0.3s ease;
}

.fixed-top-button:hover {
    background: #1a66e0;
}

.fixed-top-button i {
    margin-right: 8px;
}

/* Pulsing animation */
@keyframes pulse-bg {
    0% { background-color: #2575fc; box-shadow: 0 0 0 0 rgba(37, 117, 252, 0.7); }
    50% { background-color: #1a66e0; box-shadow: 0 0 0 10px rgba(26, 102, 224, 0); }
    100% { background-color: #2575fc; box-shadow: 0 0 0 0 rgba(37, 117, 252, 0.7); }
}

.pulsing {
    animation: pulse-bg 2s ease-in-out infinite;
}

/* Transition effects */
.lesson-form.slide-out {
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
}

.lesson-form.slide-in {
    transform: translateY(0);
    opacity: 1;
}

/* Hide WordPress Page Title */
.entry-header, .page-header, .entry-title {
    display: none !important;
}

/* Lesson Output Styling */
#lessonOutput {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-top: 25px;
    transition: opacity 400ms ease-in-out;
    opacity: 0;
    display: none;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

#lessonOutput.fade-in {
    opacity: 1;
    display: block;
}

#lessonOutput.fade-out {
    opacity: 0;
    transition: opacity 250ms ease-in-out;
}

#lessonContent {
    margin-bottom: 20px;
}

/* Lesson Content Styling */
#lessonOutput h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #2575fc;
}

#lessonOutput h2 {
    font-size: 24px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #4a5568;
}

#lessonOutput h3 {
    font-size: 20px;
    margin-top: 25px;
    margin-bottom: 10px;
    color: #4a5568;
}

#lessonOutput p {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #4a5568;
}

#lessonOutput ul, #lessonOutput ol {
    margin-bottom: 20px;
    padding-left: 25px;
}

#lessonOutput li {
    margin-bottom: 10px;
    line-height: 1.5;
}

#lessonOutput img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

/* Clean Architecture: Lesson content area */
.lesson-content-area {
    margin-bottom: 20px;
    min-height: 200px;
}

/* Action buttons for lesson output - Clean Architecture */
.lesson-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
}

/* Ensure lesson output container is properly styled */
#lessonOutput {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-top: 25px;
}

.lesson-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #f7f9fc;
    color: #4a5568;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lesson-action-button:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.lesson-action-button.primary {
    background: #2575fc;
    color: white;
}

.lesson-action-button.primary:hover {
    background: #1a66e0;
}

.lesson-action-button .dashicons {
    margin-right: 8px;
}

.lesson-action-button.copied,
.lesson-action-button.success {
    background: #4caf50;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.lesson-action-button.error {
    background: #f44336;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}

.lesson-action-button.copied:hover,
.lesson-action-button.success:hover {
    background: #45a049;
}

.lesson-action-button.error:hover {
    background: #da190b;
}

/* Copy-as-text split button + dropdown */
.lg-copy-dropdown-wrap {
    position: relative;
    display: inline-flex;
    border-radius: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lg-copy-dropdown-wrap:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Prevent individual buttons from moving — wrapper handles it */
.lg-copy-dropdown-wrap .lesson-action-button:hover {
    transform: none;
    box-shadow: none;
}

.lg-copy-dropdown-wrap .lesson-action-button:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.lg-copy-dropdown-wrap .lg-copy-toggle {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 12px 8px;
    border-left: 1px solid rgba(0,0,0,0.1);
}

.lg-copy-dropdown-wrap .lg-copy-toggle .dashicons {
    margin-right: 0;
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.lg-copy-dropdown-wrap .lg-copy-toggle[aria-expanded="true"] .dashicons {
    transform: rotate(180deg);
}

.lg-copy-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin: 4px 0 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    min-width: 180px;
}

.lg-copy-menu.open {
    display: block;
}

.lg-copy-menu li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #4a5568;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.lg-copy-menu li:hover {
    background: #f0f4ff;
    color: #2575fc;
}

.lg-copy-menu li .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Feedback form styling - matched with dashboard */
.lesson-feedback {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-top: 30px;
    margin-bottom: 25px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.lesson-feedback h3 {
    font-size: 22px;
    margin-top: 0;
    margin-bottom: 15px;
    color: #4a5568;
}

.lesson-feedback p {
    margin-bottom: 20px;
    color: #4a5568;
}

/* Feedback Container */
.feedback-container {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.feedback-container h2 {
    font-size: 24px;
    font-weight: 500;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
}

.feedback-container p {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Star Rating - Left to Right as in screenshot */
.star-rating {
    display: flex;
    margin-bottom: 20px;
}

.star {
    color: #ccc;
    font-size: 20px;
    margin-right: 15px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.star:hover, .star.selected {
    color: #333;
}

/* Feedback Textarea */
#feedback-comment {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
    font-family: inherit;
    resize: vertical;
}

/* Submit Button */
.feedback-button {
    background-color: #003366;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease;
}

.feedback-button:hover {
    background-color: #002855;
}

/* Thank You Message */
.rating-thankyou {
    text-align: center;
    padding: 30px 20px;
}

.rating-thankyou h3 {
    font-size: 24px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
}

.rating-thankyou p {
    color: #555;
    font-size: 16px;
    line-height: 1.5;
}

/* Star Labels */
.star-labels {
    display: flex;
    justify-content: space-between;
    margin: 5px 0 15px;
    padding: 0 5px;
    font-size: 14px;
    color: #4a5568;
}

/* Rating Thank You Message */
.rating-thankyou {
    text-align: center;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 8px;
    border: 1px solid #bee3f8;
}

.rating-thankyou h3 {
    color: #2b6cb0;
    margin-bottom: 10px;
    font-size: 22px;
}

.rating-thankyou p {
    color: #4a5568;
    font-size: 16px;
}

/* Feedback Comment */
.lg-feedback-comment {
    margin-bottom: 20px;
}

.lg-feedback-comment label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.lg-feedback-comment textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    resize: vertical;
}

.lg-feedback-comment textarea:focus {
    border-color: #2575fc;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.lg-feedback-form button {
    padding: 12px 20px;
    background: #2575fc;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lg-feedback-form button:hover {
    background: #1a66e0;
    transform: translateY(-2px);
}

.lg-feedback-form button.success {
    background: #28a745;
}

.lg-feedback-form button.error {
    background: #dc3545;
}

/* Responsive Styling */
@media (max-width: 768px) {
    .lesson-form {
        padding: 15px;
    }
    
    .lesson-form-header {
        padding: 20px 15px;
    }
    
    .lesson-form-header h2 {
        font-size: 24px;
    }
    
    .tab-button {
        padding: 10px;
        font-size: 14px;
    }
    
    .lesson-form input[type="text"],
    .lesson-form select {
        padding: 10px;
        font-size: 14px;
    }
    
    .form-button {
        padding: 12px;
        font-size: 16px;
    }
}

.lg-accordion { 
    
    
    margin:16px 0; 

}
.lg-acc-toggle { 
    width:100%; 
    text-align:left; 
    background:#e9e9ed; 
    cursor:pointer; 


    padding: 12px 0px 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 0px;
    transition: border-color 0.2s ease;
}
.lg-acc-panel { 
    padding:30px 12px 12px 12px; 
    background:#fff; 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 0px 0px 6px 6px;
    border:1px solid #cccccc;
    border-width: 0px 1px 1px 1px;
    margin-top: -3px;
}
.lg-acc-caret {
    float:right; opacity:.7;
    text-indent: -99999px;
    background: url(../assets/down-arrow.svg) no-repeat center center;
    background-size: contain;
    width: 20px;
}

/* Question Count Info & Warning */
.question-count-info {
    margin-top: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
}

.question-count-warning {
    margin-top: 10px;
    padding: 10px 14px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 13px;
    line-height: 1.4;
}

/* Lexile Help Collapsible */
.lexile-help {
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.lexile-help summary {
    cursor: pointer;
    font-weight: 500;
    color: #2575fc;
    font-size: 14px;
    outline: none;
}

.lexile-help summary:hover {
    color: #1a66e0;
}

.lexile-help p {
    margin: 12px 0 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: #4a5568;
}

.lexile-help p strong {
    color: #2d3748;
}

/* ==========================================================================
   Learner Profile Selector - Upgrade Encouragement
   ========================================================================== */

.learner-profile-selector {
    margin-bottom: 20px;
}

.learner-profile-selector.feature-locked {
    position: relative;
}

.learner-profile-selector .disabled-feature {
    background-color: #f7f9fc;
    color: #a0aec0;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.learner-profile-selector .disabled-feature:disabled {
    opacity: 0.8;
}

.learner-profile-selector .upgrade-prompt {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: -12px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #92400e;
}

.learner-profile-selector .upgrade-prompt a {
    color: #d97706;
    font-weight: 600;
    text-decoration: underline;
}

.learner-profile-selector .upgrade-prompt a:hover {
    color: #b45309;
}

/* Feature locked notices for accordion panels */
.lg-accordion .feature-locked-notice {
    background-color: #f7f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.lg-accordion .feature-locked-notice .locked-label {
    color: #a0aec0;
    font-size: 14px;
}

.lg-accordion .upgrade-prompt {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #92400e;
}

.lg-accordion .upgrade-prompt a {
    color: #d97706;
    font-weight: 600;
    text-decoration: underline;
}

.lg-accordion .upgrade-prompt a:hover {
    color: #b45309;
}

/* Spec 1: Template info panel */
.lg-template-info {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f0f4f8;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 13px;
}
.lg-template-info-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.lg-template-info-header .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #475467;
}
.lg-template-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.lg-qt-pill {
    display: inline-block;
    padding: 3px 10px;
    background: #e8eef6;
    border-radius: 12px;
    font-size: 12px;
}
.lg-qt-pill--zero {
    background: #f2f4f7;
    color: #98a2b3;
    text-decoration: line-through;
}
.lg-stale-badge {
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}
/* Issue #6: distinct styling when source template was deleted (no upgrade path).
   Uses neutral grey instead of amber to differentiate from "Newer version available"
   which implies an actionable upgrade. */
.lg-stale-badge.lg-stale-badge--deleted {
    background: #f3f4f6;
    color: #6b7280;
}
.lg-refresh-btn {
    margin-top: 8px;
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.lg-refresh-btn:hover {
    background: #f9fafb;
    border-color: #98a2b3;
}
.lg-refresh-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}
.lg-refresh-btn .dashicons.spin {
    animation: lg-spin 1s linear infinite;
}
@keyframes lg-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
