/**
 * Curriculum Modals CSS
 * Styling for inline editing modals in curriculum browse page
 * Following the project's CSS best practices for reusable components
 */

/* ==========================================
 * MODAL DIALOG - Use Bootstrap defaults
 * ========================================== */

.curriculum-edit-modal .modal-dialog {
    max-width: 800px;
}

.curriculum-edit-modal.modal-lg .modal-dialog {
    max-width: 900px;
}

/* ==========================================
 * MODAL BODY
 * ========================================== */

.curriculum-edit-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* ==========================================
 * FORM SECTIONS
 * ========================================== */

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    color: var(--color-accent);
    font-size: 1rem;
}

/* ==========================================
 * ACE EDITOR STYLING
 * ========================================== */

.ace-editor-container {
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
    height: 200px;
}

.ace-editor-container.large {
    height: 300px;
}

.ace-editor-container:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ==========================================
 * DRAG AND DROP STYLING
 * ========================================== */

.drag-handle {
    cursor: move;
    color: var(--color-text-muted);
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    margin-right: 8px;
    font-size: 0.875rem;
}

.tier-item:hover .drag-handle-tier,
.section-item:hover .drag-handle-section,
.objective-item:hover .drag-handle-objective {
    opacity: 1;
}

.drag-handle:hover {
    color: #667eea;
}

.dragging {
    opacity: 0.5;
    background: var(--color-surface-raised);
}

/* ==========================================
 * EDIT/DELETE BUTTONS
 * ========================================== */

.curriculum-actions {
    display: inline-flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tier-link:hover .curriculum-actions,
.section-link:hover .curriculum-actions,
.objective-link:hover .curriculum-actions {
    opacity: 1;
}

.btn-edit-inline,
.btn-delete-inline,
.btn-add-inline {
    background: none;
    border: none;
    color: var(--color-text-muted);
    padding: 4px 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    border-radius: 4px;
}

.btn-edit-inline:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.btn-delete-inline:hover {
    color: #f5576c;
    background: rgba(245, 87, 108, 0.1);
}

.btn-add-inline {
    margin-left: 8px;
}

.btn-add-inline i {
    margin-right: 4px;
}

/* ==========================================
 * HELP TEXT AND HINTS
 * ========================================== */

.form-text {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.field-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 0.5rem;
}

/* ==========================================
 * RESPONSIVE DESIGN
 * ========================================== */

@media (max-width: 768px) {
    .curriculum-edit-modal .modal-dialog {
        max-width: 95%;
        margin: 0.5rem auto;
    }

    .curriculum-edit-modal .modal-body {
        padding: 1.5rem;
    }

    .curriculum-edit-modal .modal-header,
    .curriculum-edit-modal .modal-footer {
        padding: 1rem 1.5rem;
    }

    .ace-editor-container {
        height: 150px;
    }

    .ace-editor-container.large {
        height: 200px;
    }
}

/* ==========================================
 * LOADING STATES
 * ========================================== */

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: button-loading-spinner 0.6s linear infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* ==========================================
 * ADDITIONAL UTILITY CLASSES
 * ========================================== */

.text-muted-light {
    color: var(--color-text-muted) !important;
}

.mb-small {
    margin-bottom: 0.5rem !important;
}

.mt-small {
    margin-top: 0.5rem !important;
}
