/* SOP Builder Styles */

:root {
    --primary-color: #007cba;
    --primary-dark: #005a87;
    --success-color: #46b450;
    --warning-color: #ffc107;
    --error-color: #cc0000;
    --light-gray: #f9f9f9;
    --border-color: #e0e0e0;
    --text-color: #333;
    --text-light: #666;
}

/* ====== INTRO MODAL ====== */
.gobliss-modal.full-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10000;
}

.gobliss-modal.full-screen[hidden] {
    display: none;
}

.gobliss-modal.full-screen .gobliss-modal-content {
    width: min(100%, 900px);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.intro-content {
    padding: 50px 40px;
}

.intro-header {
    text-align: center;
    margin-bottom: 40px;
}

.intro-header h1 {
    margin: 0 0 10px 0;
    font-size: 36px;
    color: var(--primary-color);
}

.intro-tagline {
    margin: 0;
    font-size: 18px;
    color: var(--text-light);
    font-weight: 500;
}

.intro-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.intro-step {
    background: #f0f8ff;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    text-align: center;
}

.intro-step .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 24px;
    margin-bottom: 15px;
}

.intro-step h3 {
    margin: 15px 0 10px 0;
    font-size: 18px;
    color: var(--text-color);
}

.intro-step p {
    margin: 0;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

.intro-benefits {
    background: #f9fff9;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0ffe0;
    margin-bottom: 30px;
}

.intro-benefits h3 {
    margin: 0 0 15px 0;
    color: var(--success-color);
}

.intro-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.intro-benefits li {
    padding: 8px 0;
    color: var(--text-color);
    font-size: 14px;
}

.btn-large {
    width: 100%;
    padding: 16px 20px !important;
    font-size: 18px !important;
    min-height: 50px !important;
}

.intro-note {
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    margin: 0;
}

/* ====== MAIN BUILDER ====== */
.gobliss-sop-builder-container {
    max-width: 1280px;
    margin: 0 auto;
}

.gobliss-inline-notice {
    margin: 18px 16px 0;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
}

.gobliss-inline-notice.success {
    background: #edf9ef;
    border: 1px solid #b7e4c7;
    color: #166534;
}

.gobliss-inline-notice.warning {
    background: #fff7e6;
    border: 1px solid #f6d28b;
    color: #9a6700;
}

.gobliss-lead-capture-bar {
    margin: 20px 16px 0;
    padding: 16px 18px;
    border: 1px solid #d6e8ff;
    border-radius: 12px;
    background: linear-gradient(90deg, #eef7ff 0%, #ffffff 100%);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.gobliss-lead-capture-bar strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-color);
}

.gobliss-lead-capture-bar p {
    margin: 0;
    color: var(--text-light);
    font-size: 13px;
}

.lead-capture-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.guest-auth-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-right: 10px;
}

.guest-auth-card {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid #dbe7f3;
    border-radius: 10px;
    background: #f8fbff;
}

.guest-auth-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-color);
}

.guest-auth-card p {
    margin: 0 0 10px;
    color: var(--text-light);
    font-size: 13px;
    line-height: 1.5;
}

.sop-builder-hero {
    margin: 24px auto 18px;
    padding: 0 16px;
}

.sop-builder-hero .intro-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.intro-inline-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sop-builder-main {
    max-width: 1280px;
    margin: 24px auto 40px;
    padding: 0 16px !important;
}

.sop-builder-workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sop-sections-sidebar {
    position: sticky;
    top: 20px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sidebar-header h3 {
    margin: 0 0 6px;
    color: var(--text-color);
}

.sidebar-header p {
    margin: 0 0 14px;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.5;
}

.section-nav-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-nav-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.section-nav-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.08);
    transform: translateY(-1px);
}

.section-nav-item.active {
    border-color: var(--primary-color);
    background: #eef7ff;
}

.section-nav-item.completed {
    background: #f7fff8;
}

.section-nav-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e6f2ff;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.section-nav-item.completed .section-nav-index {
    background: #e8f7eb;
    color: var(--success-color);
}

.section-nav-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-nav-copy strong {
    color: var(--text-color);
    font-size: 14px;
}

.section-nav-copy small {
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.4;
}

.sop-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.header-left h1 {
    margin: 0 0 5px 0;
    font-size: 28px;
    color: var(--text-color);
}

.header-left p {
    margin: 0;
    color: var(--text-light);
    font-size: 14px;
}

.header-right .btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

/* ====== PROGRESS BAR ====== */
.sop-progress-bar {
    margin-bottom: 30px;
}

.progress-fill {
    width: 12.5%;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    border-radius: 3px;
    transition: width 0.3s ease;
    margin-bottom: 8px;
}

#progress-text {
    display: inline-block;
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

/* ====== SECTION DISPLAY ====== */
.sop-section-container {
    margin-bottom: 50px;
}

.section-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 35px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    gap: 20px;
}

.section-info {
    flex: 1;
}

.section-badge {
    display: inline-block;
    background: #e6f2ff;
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.section-title {
    margin: 10px 0 8px 0;
    font-size: 24px;
    color: var(--text-color);
    font-weight: 700;
}

.section-subtitle {
    margin: 0;
    color: var(--text-light);
    font-size: 15px;
}

.section-metadata {
    white-space: nowrap;
}

.word-count-badge {
    display: inline-block;
    background: var(--light-gray);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-color);
    font-weight: 500;
}

/* ====== GUIDANCE BOX ====== */
.section-guidance {
    display: flex;
    gap: 15px;
    background: #f0f8ff;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 20px;
}

.guidance-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.guidance-content h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: var(--primary-color);
    font-weight: 600;
}

.guidance-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.6;
}

/* ====== SECTION ACTIONS ====== */
.section-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 8px 14px !important;
    font-size: 13px !important;
    min-height: 36px !important;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--light-gray);
    border-color: var(--primary-color);
}

/* ====== TEXTAREA ====== */
.section-form {
    margin-bottom: 20px;
}

.section-form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-color);
}

.section-textarea {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 280px;
    transition: border-color 0.3s;
}

.section-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.textarea-stats {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-light);
}

.word-count,
.char-count,
.target-words {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ====== SECTION COACH PANEL ====== */
.section-coach-panel {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    background: linear-gradient(180deg, #f9fcff 0%, #ffffff 100%);
}

.section-coach-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.section-coach-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    color: var(--text-color);
}

.section-coach-header p {
    margin: 0;
    color: var(--text-light);
    font-size: 13px;
}

.coach-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.coach-status-idle {
    background: #eef2f7;
    color: #475569;
}

.coach-status-needs {
    background: #fff4e5;
    color: #9a6700;
}

.coach-status-almost {
    background: #fff7d6;
    color: #8a6d00;
}

.coach-status-ready {
    background: #edf9ef;
    color: #166534;
}

.section-coach-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.coach-usage-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-light);
}

.coach-note,
.coach-empty {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
}

.coach-feedback-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.coach-list {
    padding: 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e7edf3;
}

.coach-list strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-color);
}

.coach-list ul {
    margin: 0;
    padding-left: 18px;
}

.coach-list li {
    margin-bottom: 6px;
    color: var(--text-color);
    font-size: 13px;
    line-height: 1.5;
}

.coach-good {
    background: #f7fff8;
}

.coach-missing {
    background: #fffaf3;
}

.coach-next {
    background: #f8fbff;
}

.coach-inline-message {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.coach-inline-message.success {
    background: #edf9ef;
    color: #166534;
    border: 1px solid #b7e4c7;
}

.coach-inline-message.error {
    background: #fff1f2;
    color: #b42318;
    border: 1px solid #fecdd3;
}

.coach-lead-cta {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px dashed #cfe0f5;
    border-radius: 10px;
    background: #fbfdff;
}

.coach-lead-cta strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-size: 13px;
}

.auth-content {
    width: min(100%, 640px) !important;
}

/* ====== NAVIGATION BUTTONS ====== */
.section-navigation {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-prev {
    flex: 1;
    min-width: 120px;
}

.btn-skip {
    flex: 1;
    min-width: 150px;
}

.btn-next {
    flex: 1;
    min-width: 150px;
}

/* ====== AUTO-SAVE ====== */
.auto-save-indicator {
    margin-top: 15px;
    text-align: right;
}

.auto-save-status {
    font-size: 12px;
    color: var(--text-light);
}

/* ====== MODALS ====== */
.gobliss-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
}

.gobliss-modal[hidden] {
    display: none;
}

.gobliss-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-lg {
    max-width: 800px;
}

.gobliss-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.gobliss-modal-close:hover {
    background: var(--light-gray);
    color: var(--text-color);
}

.gobliss-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--text-color);
}

.modal-body {
    color: var(--text-color);
    line-height: 1.7;
}

.modal-tips-content ul,
.modal-example-content ul {
    padding-left: 20px;
}

.modal-tips-content li {
    margin-bottom: 12px;
    line-height: 1.6;
}

.example-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.example-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.example-item h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 15px;
}

.example-item p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.7;
    font-size: 14px;
}

/* ====== COMPLETION MODAL ====== */
.completion-content {
    text-align: center;
    padding: 50px 40px;
}

.completion-header h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    color: var(--success-color);
}

.completion-header p {
    margin: 0;
    font-size: 18px;
    color: var(--text-light);
}

.completion-info {
    background: #f0fff9;
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
    border: 1px solid #d4f8e8;
}

.completion-info p {
    margin: 0 0 15px 0;
    color: var(--text-color);
}

.completion-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.completion-info li {
    padding: 8px 0;
    color: var(--text-color);
}

.completion-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 30px;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .intro-content {
        padding: 30px 20px;
    }

    .intro-header h1 {
        font-size: 24px;
    }

    .intro-steps {
        grid-template-columns: 1fr;
    }

    .sop-builder-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .guest-auth-strip,
    .lead-capture-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .section-card {
        padding: 20px;
    }

    .section-card-header {
        flex-direction: column;
    }

    .section-navigation {
        flex-direction: column;
    }

    .btn-prev,
    .btn-skip,
    .btn-next {
        width: 100%;
        min-width: initial;
    }

    .gobliss-modal-content {
        padding: 20px;
    }

    .completion-content {
        padding: 30px 20px;
    }
}

/* ====== STAGE 2 RESULTS ====== */
.refine-content {
    width: min(100%, 1100px) !important;
    max-height: 92vh;
    overflow-y: auto;
    padding: 28px;
}

/* ====== STAGE 3 EXPERT REVIEW ====== */
.expert-review-content {
    width: min(100%, 860px) !important;
    max-height: 92vh;
    overflow-y: auto;
    padding: 28px;
}

.expert-review-header h2 {
    margin: 0 0 8px;
    color: var(--primary-color);
}

.expert-review-header p {
    margin: 0 0 18px;
    color: var(--text-light);
    line-height: 1.6;
}

.expert-review-form .form-grid {
    display: grid;
    gap: 16px;
}

.expert-review-form .two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.expert-review-form .field-full {
    grid-column: 1 / -1;
}

.expert-review-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.expert-review-form input,
.expert-review-form textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 15px;
    box-sizing: border-box;
}

.expert-review-form textarea {
    resize: vertical;
    min-height: 110px;
}

.expert-review-status {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    line-height: 1.6;
}

.expert-review-status.success {
    background: #edf9ef;
    color: #166534;
    border: 1px solid #b7e4c7;
}

.expert-review-status.error {
    background: #fff1f2;
    color: #b42318;
    border: 1px solid #fecdd3;
}

.refine-header h2 {
    margin: 0 0 8px;
    color: var(--primary-color);
}

.refine-header p {
    margin: 0 0 14px;
    color: var(--text-light);
}

.result-meta {
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #eef7ff;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 600;
}

.refine-results-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.refine-panel {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
}

.refine-panel.refined {
    background: #f8fff8;
    border-color: #b9e4c0;
}

.refine-panel.single-column {
    max-width: 860px;
}

.refine-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.sop-result-text {
    line-height: 1.8;
    color: var(--text-color);
    white-space: normal;
}

.comparison-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 18px;
    flex-wrap: wrap;
}

.locked-result {
    position: relative;
}

.lock-notice {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff7e6;
    color: #9a6700;
    border: 1px solid #f6d28b;
    font-weight: 600;
}

.purchase-options {
    margin-top: 18px;
}

.purchase-options h3 {
    margin-bottom: 12px;
}

.purchase-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.purchase-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.purchase-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
}

.purchase-card p {
    margin-top: 0;
    color: var(--text-light);
}

.purchase-meta {
    margin: 10px 0 14px;
    font-weight: 700;
    color: var(--primary-dark);
}

@media (max-width: 1024px) {
    .sop-builder-workspace {
        grid-template-columns: 1fr;
    }

    .sop-sections-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .refine-results-grid {
        grid-template-columns: 1fr;
    }

    .expert-review-form .two-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .intro-step .step-num {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .section-title {
        font-size: 18px;
    }

    .section-actions {
        flex-direction: column;
    }

    .btn-sm {
        width: 100%;
    }

    .textarea-stats {
        flex-direction: column;
        gap: 8px;
    }

    .comparison-actions {
        flex-direction: column;
    }
}
