﻿/* ==========================================
   MANUSCRIPT GENERATION TRACKER - STYLES
   ==========================================
   - Phase tracker (top level)
   - Dynamic chapter pills
   - Section pills  
   - Activity card
   - Review panels
   ========================================== */

/* ==========================================
   PHASE TRACKER (Top Level - 7 Steps)
   ========================================== */
#manuscriptPhaseTracker {
    padding: 1rem;
}

.phase-tracker-container {
    position: relative;
    padding: 0 20px;
}

.phase-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.phase-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

    .phase-step .phase-bubble {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #e9ecef;
        border: 2px solid #dee2e6;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        color: #6c757d;
        transition: all 0.3s ease;
    }

    .phase-step .phase-label {
        font-size: 0.65rem;
        color: #6c757d;
        margin-top: 4px;
        text-align: center;
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Phase states */
    .phase-step.active .phase-bubble {
        background: #0d6efd;
        border-color: #0d6efd;
        color: white;
        animation: phasePulse 1.5s infinite;
    }

    .phase-step.active .phase-label {
        color: #0d6efd;
        font-weight: 600;
    }

    .phase-step.completed .phase-bubble {
        background: #198754;
        border-color: #198754;
        color: white;
    }

    .phase-step.completed .phase-label {
        color: #198754;
    }

    .phase-step.done .phase-bubble {
        animation: none !important;
    }

    .phase-step.clickable {
        cursor: pointer;
    }

        .phase-step.clickable:hover .phase-bubble {
            transform: scale(1.1);
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }

    .phase-step.reviewing .phase-bubble {
        background: #6f42c1 !important;
        border-color: #6f42c1 !important;
        transform: scale(1.1);
    }

@keyframes phasePulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(13, 110, 253, 0.1);
    }
}

/* Phase progress bar */
.phase-bar-bg {
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    z-index: 0;
}

.phase-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #198754, #0d6efd);
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

    .phase-bar-fill.complete {
        background: linear-gradient(90deg, #198754, #20c997) !important;
    }


/* ==========================================
   CHAPTER TRACKER (Dynamic Pills)
   ========================================== */
.chapter-tracker {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.chapter-tracker-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
}

.chapter-progress-text {
    margin-left: auto;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #6c757d;
}

.chapter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.chapter-pill {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e9ecef;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
    cursor: default;
}

    .chapter-pill .pill-number {
        line-height: 1;
    }

    /* Chapter pill states */
    .chapter-pill.active {
        background: #0d6efd;
        border-color: #0d6efd;
        color: white;
        animation: chapterPulse 1.2s infinite;
    }

@keyframes chapterPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 6px rgba(13, 110, 253, 0.15);
    }
}

.chapter-pill.completed {
    background: #198754;
    border-color: #198754;
    color: white;
    animation: none;
}

    .chapter-pill.completed::after {
        content: "✓";
        position: absolute;
        font-size: 0.6rem;
    }

.chapter-pill.clickable {
    cursor: pointer;
}

    .chapter-pill.clickable:hover {
        transform: scale(1.15);
        box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    }

.chapter-pill.reviewing {
    background: #6f42c1 !important;
    border-color: #6f42c1 !important;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(111, 66, 193, 0.3);
}

/* Chapter progress bar */
.chapter-bar-bg {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.chapter-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #198754, #20c997);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}


/* ==========================================
   SECTION TRACKER (Other Book Matter)
   ========================================== */
.section-tracker {
    background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
    border: 1px solid #ffeeba;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.section-tracker-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #856404;
    font-size: 0.85rem;
}

.section-progress-text {
    margin-left: auto;
    background: #ffeeba;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #856404;
}

.section-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.section-pill {
    padding: 6px 12px;
    border-radius: 16px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    font-size: 0.75rem;
    font-weight: 500;
    color: #856404;
    transition: all 0.3s ease;
    cursor: default;
}

    .section-pill.active {
        background: #fd7e14;
        border-color: #fd7e14;
        color: white;
        animation: sectionPulse 1.2s infinite;
    }

@keyframes sectionPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(253, 126, 20, 0.15);
    }
}

.section-pill.completed {
    background: #198754;
    border-color: #198754;
    color: white;
    animation: none;
}

.section-pill.clickable {
    cursor: pointer;
}

    .section-pill.clickable:hover {
        transform: scale(1.1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

.section-pill.reviewing {
    background: #6f42c1 !important;
    border-color: #6f42c1 !important;
    transform: scale(1.1);
}


/* ==========================================
   ACTIVITY CARD (Current Status)
   ========================================== */
#manuscriptActivityCard {
    margin-bottom: 1rem;
}

.activity-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.activity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.75rem;
}

.activity-spinner {
    flex-shrink: 0;
}

.activity-titles {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-weight: 600;
    color: #212529;
    font-size: 1rem;
    line-height: 1.3;
}

.activity-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 2px;
}

.activity-content {
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

    /* Simplify nested content in activity card */
    .activity-content .text-center {
        text-align: left !important;
        padding: 0 !important;
    }

    .activity-content .spinner-border {
        width: 1.25rem;
        height: 1.25rem;
    }

    .activity-content h5 {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }

    .activity-content .py-4 {
        padding: 0.5rem 0 !important;
    }


/* ==========================================
   COMPLETION CARD
   ========================================== */
.completion-card {
    text-align: center;
    padding: 2rem 1rem;
}

.completion-icon {
    margin-bottom: 1rem;
}

.completion-title {
    color: #198754;
    margin-bottom: 0.5rem;
}

.completion-subtitle {
    margin-bottom: 1.5rem;
}

.completion-actions {
    margin-bottom: 1rem;
}

.completion-hint {
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}


/* ==========================================
   REVIEW PANEL
   ========================================== */
#manuscriptReviewPanel {
    margin-bottom: 1rem;
}

.review-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    color: white;
}

.chapter-review-header {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

.section-review-header {
    background: linear-gradient(135deg, #fd7e14 0%, #ffc107 100%);
}

.phase-review-header {
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
}

.review-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.review-title {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-content {
    padding: 1rem;
    max-height: 350px;
    overflow-y: auto;
}

.review-footer {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}


/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */
@media (max-width: 768px) {
    .phase-steps {
        gap: 4px;
    }

    .phase-step .phase-bubble {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .phase-step .phase-label {
        font-size: 0.55rem;
    }

    .chapter-pill {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    .section-pill {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
}


/* ==========================================
   "WRITING..." INDICATOR
   ========================================== */
.writing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

    .writing-indicator .writing-dots {
        display: inline-flex;
        gap: 3px;
    }

    .writing-indicator .writing-dot {
        width: 6px;
        height: 6px;
        background: white;
        border-radius: 50%;
        animation: writingBounce 1.4s ease-in-out infinite;
    }

        .writing-indicator .writing-dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .writing-indicator .writing-dot:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes writingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}


/* ==========================================
   PANEL HEADER STYLES
   ========================================== */
.manuscript-panel-header {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .manuscript-panel-header h5 {
        margin: 0;
        font-size: 1rem;
    }

    .manuscript-panel-header .badge {
        font-size: 0.7rem;
    }
