/**
 * Course Admin Styles
 *
 * Styling for course post type admin interface
 *
 * @package Video_Slider_Elementor
 * @since 1.0.0
 */

/* ==========================================================================
   Course Sections Meta Box
   ========================================================================== */

#course-sections-container {
    margin-top: 10px;
}

#sections-list {
    margin-bottom: 20px;
}

.section-row {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.section-row:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.section-row.ui-sortable-helper {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    cursor: default;
}

.section-handle {
    cursor: move;
    color: #999;
    margin-right: 10px;
    font-size: 18px;
}

.section-handle:hover {
    color: #333;
}

.section-title-display {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.section-header .button {
    margin-left: 8px;
}

.toggle-section {
    min-width: 70px;
}

.remove-section {
    color: #b32d2e;
}

.remove-section:hover {
    color: #dc3232;
}

/* Section Content */
.section-content {
    padding: 20px;
    background: #fff;
}

.section-content > p {
    margin-bottom: 20px;
}

.section-content > p:last-child {
    margin-bottom: 0;
}

.section-content label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

.section-content input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
}

.section-content .description {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 13px;
}

.section-content .slug-preview {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: #0073aa;
}

/* WordPress Editor in Sections */
.section-content .wp-editor-wrap {
    margin-top: 10px;
}

/* Add Section Button */
#add-section-btn {
    font-size: 14px;
    padding: 8px 20px;
    height: auto;
}

#add-section-btn:before {
    content: '\f132';
    font-family: dashicons;
    margin-right: 5px;
    font-size: 16px;
    vertical-align: middle;
}

/* ==========================================================================
   Dashboard Course Sync
   ========================================================================== */

#course-dashboard-sync {
    padding: 10px 0;
}

#course-dashboard-sync label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

#dashboard_course_select {
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
}

#refresh-courses-btn {
    width: 100%;
    text-align: center;
}

#refresh-courses-btn:before {
    content: '\f463';
    font-family: dashicons;
    margin-right: 5px;
    font-size: 16px;
    vertical-align: middle;
}

#course-dashboard-sync .spinner {
    margin: 5px 0 0 8px;
}

#course-dashboard-sync .description {
    margin-top: 10px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

/* ==========================================================================
   Admin Columns
   ========================================================================== */

.column-dashboard_course {
    width: 200px;
}

.column-sections_count {
    width: 100px;
    text-align: center;
}

.column-sections_count strong {
    color: #0073aa;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

#sections-list:empty:before {
    content: 'No sections added yet. Click "Add Section" to create your first section.';
    display: block;
    padding: 30px;
    text-align: center;
    color: #999;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 4px;
    font-style: italic;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media screen and (max-width: 782px) {
    .section-header {
        flex-wrap: wrap;
    }

    .section-title-display {
        width: 100%;
        margin-bottom: 10px;
    }

    .section-header .button {
        margin-left: 0;
        margin-right: 8px;
    }

    #refresh-courses-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.section-row.loading {
    opacity: 0.6;
    pointer-events: none;
}

.section-row.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Course Category Image
   ========================================================================== */

#category-image-wrapper {
    margin: 10px 0;
}

#category-image-wrapper img {
    max-width: 100%;
    max-height: 200px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.course_category_media_button,
.course_category_media_remove {
    margin-top: 10px;
}

/* Taxonomy image column */
.column-image {
    width: 80px;
}

.column-image img {
    display: block;
    border-radius: 4px;
}

/* ==========================================================================
   Admin Notices
   ========================================================================== */

.notice.notice-course-sync {
    position: relative;
    padding: 12px 20px;
}

.notice.notice-course-sync.is-dismissible {
    padding-right: 38px;
}

/* ==========================================================================
   Drag and Drop Visual Feedback
   ========================================================================== */

.section-row.ui-sortable-placeholder {
    visibility: visible !important;
    background: #f0f6fc;
    border: 2px dashed #0073aa;
    height: 60px;
}

.section-row.ui-sortable-placeholder * {
    visibility: hidden;
}

/* ==========================================================================
   Course Meta Fields
   ========================================================================== */

.course-details-wrapper .meta-field,
.course-statistics-wrapper .meta-field {
    margin-bottom: 15px;
}

.course-details-wrapper label,
.course-statistics-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Definition-driven course values */
.course-meta-values-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.course-meta-value-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(360px, 2fr);
    gap: 12px;
    align-items: start;
    border: 1px solid var(--iabt-border, #ccd0d4);
    border-radius: 6px;
    padding: 10px 12px;
    background: var(--iabt-bg-main, #ffffff);
}

.course-meta-value-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}

.course-meta-value-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid var(--iabt-border, #ccd0d4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--iabt-bg-soft, #f6f7f7);
    color: var(--iabt-primary, #1d4f91);
    flex-shrink: 0;
}

.course-meta-value-label {
    font-weight: 600;
    color: var(--iabt-text-primary, #1d2327);
}

.course-meta-value-input {
    min-width: 0;
}

.course-meta-value-textarea {
    resize: vertical;
    min-height: 58px;
    white-space: pre-wrap;
    line-height: 1.4;
}

.course-meta-empty-state {
    padding: 12px;
    border: 1px dashed var(--iabt-border, #ccd0d4);
    border-radius: 6px;
    background: var(--iabt-bg-soft, #f6f7f7);
}

.course-meta-empty-state p {
    margin: 0;
}

/* Taxonomy icon picker (Course Metas) */
.iabt-course-meta-icon-field {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 460px;
    width: 100%;
}

.iabt-course-meta-icon-select {
    min-width: 220px;
}

.iabt-course-meta-icon-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid var(--iabt-border, #ccd0d4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--iabt-primary, #1d4f91);
    background: var(--iabt-bg-soft, #f6f7f7);
    flex-shrink: 0;
}

.iabt-course-meta-icon-preview i {
    font-size: 14px;
    line-height: 1;
}

.iabt-course-meta-icon-preview--inline {
    width: 24px;
    height: 24px;
}

@media screen and (max-width: 900px) {
    .course-meta-value-row {
        grid-template-columns: 1fr;
    }
}

/* Rating Star Display */
.rating-wrapper {
    position: relative;
}

.rating-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    padding: 5px 10px;
    background: #f9f9f9;
    border-radius: 3px;
}

.rating-display .stars {
    color: #ffa500;
    font-size: 18px;
    line-height: 1;
}

.rating-display .rating-value {
    font-weight: 600;
    color: #333;
}

/* Percentage Bar */
.percentage-input-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.percentage-input-wrapper input[type="number"] {
    width: 70px;
}

.percentage-symbol {
    font-weight: 600;
    color: #666;
}

.percentage-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.percentage-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 10px;
    position: relative;
}

.percentage-fill.low {
    background: linear-gradient(90deg, var(--iabt-danger-color, #dc3545), #e74c3c);
}

.percentage-fill.medium {
    background: linear-gradient(90deg, var(--iabt-warning-color, #ffc107), #f39c12);
}

.percentage-fill.high {
    background: linear-gradient(90deg, var(--iabt-success-color, #28a745), #2ecc71);
}

/* Admin Columns */
.column-course_locations,
.column-course_rating {
    width: 150px;
}
