/**
 * Ubitto Program Creator - Course Builder Styles
 */

/* === Builder Wrapper (Frontend Admin Version) === */
.ubitto-cb-wrapper-frontend-admin {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    background: #f5f5f5;
}

/* Legacy iframe support */
.ubitto-cb-wrapper-iframe {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    background: #f5f5f5;
}

.ubitto-cb-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* === Top Navigation === */
.ubitto-cb-top-nav {
    margin-bottom: 20px;
}

/* === Header === */
.ubitto-cb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.ubitto-cb-header-left {
    flex: 1;
}

.ubitto-cb-title {
    font-size: 32px;
    font-weight: 700;
    color: #222;
    margin: 0 0 8px 0;
}

.ubitto-cb-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

.ubitto-cb-header-right {
    display: flex;
    gap: 12px;
}

/* === Content Layout === */
.ubitto-cb-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

/* === Sidebar === */
.ubitto-cb-sidebar {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    height: fit-content;
}

.ubitto-cb-sidebar h3 {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin: 0 0 20px 0;
}

.ubitto-cb-lesson-list {
    margin-bottom: 20px;
    min-height: 200px;
}

.ubitto-cb-empty-state {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 40px 20px;
}

/* === Lesson Items === */
.ubitto-cb-lesson-item {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fafafa;
    transition: all 0.3s;
}

.ubitto-cb-lesson-item:hover {
    border-color: #f26522;
}

.ubitto-cb-lesson-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ubitto-cb-drag-handle {
    cursor: move;
    color: #999;
    font-size: 18px;
}

.ubitto-cb-lesson-title {
    flex: 1;
    font-weight: 600;
    color: #222;
    font-size: 15px;
}

.ubitto-cb-lesson-actions {
    display: flex;
    gap: 8px;
}

.ubitto-cb-edit-lesson,
.ubitto-cb-delete-lesson {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    transition: color 0.3s;
}

.ubitto-cb-edit-lesson:hover {
    color: #f26522;
}

.ubitto-cb-delete-lesson:hover {
    color: #e74c3c;
}

/* === Topic List === */
.ubitto-cb-topic-list {
    margin-left: 28px;
    margin-bottom: 10px;
}

.ubitto-cb-topic-item {
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 14px;
    color: #555;
}

.ubitto-cb-add-topic-btn,
.ubitto-cb-add-quiz-btn {
    background: none;
    border: 1px dashed #ccc;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
}

.ubitto-cb-add-topic-btn:hover,
.ubitto-cb-add-quiz-btn:hover {
    border-color: #f26522;
    color: #f26522;
    background: #fff5f0;
}

/* === Main Content Area === */
.ubitto-cb-main {
    background: white;
    border-radius: 12px;
    padding: 60px 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    min-height: 600px;
}

.ubitto-cb-welcome {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.ubitto-cb-welcome-icon {
    color: #f26522;
    margin-bottom: 24px;
}

.ubitto-cb-welcome h2 {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin: 0 0 16px 0;
}

.ubitto-cb-welcome p {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.ubitto-cb-tips {
    text-align: left;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 20px;
}

.ubitto-cb-tips h4 {
    font-size: 16px;
    font-weight: 600;
    color: #222;
    margin: 0 0 12px 0;
}

.ubitto-cb-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ubitto-cb-tips li {
    padding-left: 24px;
    position: relative;
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
}

.ubitto-cb-tips li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #4caf50;
    font-weight: bold;
}

/* === Modals === */
.ubitto-cb-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.ubitto-cb-modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ubitto-cb-modal-large {
    max-width: 800px;
}

.ubitto-cb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.ubitto-cb-modal-header h3 {
    font-size: 22px;
    font-weight: 600;
    color: #222;
    margin: 0;
}

.ubitto-cb-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.ubitto-cb-modal-close:hover {
    color: #333;
}

.ubitto-cb-modal-body {
    padding: 24px;
}

.ubitto-cb-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
}

/* === Sortable Placeholder === */
.ubitto-cb-lesson-placeholder {
    border: 2px dashed #f26522;
    border-radius: 10px;
    background: #fff5f0;
    height: 80px;
    margin-bottom: 12px;
}

/* === Notifications === */
.ubitto-cb-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s;
    font-size: 15px;
    font-weight: 500;
}

.ubitto-cb-notification-show {
    transform: translateX(0);
}

.ubitto-cb-notification-success {
    background: #4caf50;
    color: white;
}

.ubitto-cb-notification-error {
    background: #e74c3c;
    color: white;
}

/* === Quiz Builder === */
#quiz-questions {
    margin-bottom: 20px;
}

.ubitto-cb-question-item {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    background: #fafafa;
    position: relative;
    padding-top: 34px;
}

.ubitto-cb-remove-question {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e74c3c;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.3s;
}

.ubitto-cb-remove-question:hover {
    background: #c0392b;
}

.ubitto-cb-answer-item {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.ubitto-cb-answer-item input[type="text"] {
    flex: 1;
}

.ubitto-cb-answer-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.ubitto-cb-remove-answer {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

/* === Iframe Modal === */
.ubitto-cb-iframe-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}

.ubitto-cb-iframe-container {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 95%;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ubitto-cb-iframe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f8f8;
    border-radius: 12px 12px 0 0;
}

.ubitto-cb-iframe-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #222;
    margin: 0;
}

.ubitto-cb-iframe-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ubitto-cb-iframe-close:hover {
    color: #333;
}

.ubitto-cb-iframe-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ubitto-cb-iframe-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* === Frontend Admin Wrapper Styles === */
.ubitto-cb-wrapper-frontend-admin .ubitto-cb-top-nav,
.ubitto-cb-wrapper-iframe .ubitto-cb-top-nav {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.ubitto-cb-frontend-admin-wrapper {
    width: 100%;
    min-height: 600px;
    background: white;
    padding: 20px;
}

/* Hide unwanted admin elements in Frontend Admin */
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #wpadminbar,
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #adminmenumain,
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper .update-nag,
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #wpfooter {
    display: none !important;
}

/* Make Frontend Admin content full width */
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #wpcontent {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Hide unnecessary course edit elements - show only Builder */
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #titlediv,
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #postdivrich,
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper .postbox:not(#learndash-course-builder),
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #postbox-container-1 {
    display: none !important;
}

/* Ensure Builder metabox is visible */
.ubitto-cb-wrapper-frontend-admin .wpfa-plugin-wrapper #learndash-course-builder {
    display: block !important;
    visibility: visible !important;
}

/* === Iframe Wrapper Styles (Legacy) === */
.ubitto-cb-wrapper-iframe .ubitto-cb-top-nav {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.ubitto-cb-header-simple {
    background: white;
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.ubitto-cb-header-simple .ubitto-cb-title {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin: 0 0 8px 0;
}

.ubitto-cb-header-simple .ubitto-cb-subtitle {
    font-size: 18px;
    color: #666;
    margin: 0 0 12px 0;
}

.ubitto-cb-header-simple .ubitto-cb-description {
    font-size: 14px;
    color: #888;
    margin: 0;
}

.ubitto-cb-iframe-wrapper {
    width: 100%;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: white;
}

.ubitto-cb-iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .ubitto-cb-content {
        grid-template-columns: 1fr;
    }

    .ubitto-cb-iframe-wrapper {
        height: calc(100vh - 180px);
    }

    .ubitto-cb-sidebar {
        order: 2;
    }

    .ubitto-cb-main {
        order: 1;
        padding: 40px 24px;
    }
}

@media (max-width: 768px) {
    .ubitto-cb-wrapper {
        padding: 20px 10px;
    }

    .ubitto-cb-title {
        font-size: 24px;
    }

    .ubitto-cb-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ubitto-cb-header-right {
        width: 100%;
    }

    .ubitto-cb-header-right .ubitto-pc-btn {
        flex: 1;
    }

    .ubitto-cb-sidebar {
        padding: 20px;
    }

    .ubitto-cb-main {
        padding: 30px 20px;
    }

    .ubitto-cb-modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
}
