/**
 * Whitepaper Architect Module — Styles
 *
 * Purpose:
 *   Styles for the whitepaper generation module: three-column layout,
 *   progress tracker, academic document preview, and PDF-ready sections.
 *
 * Design Notes:
 *   - Uses CSS custom properties from the main design system
 *   - Document preview uses serif fonts for academic feel
 *   - Progress tracker uses animated phase indicators
 *   - Responsive: collapses to single column on mobile
 */

/* ---------------------------------------------------------------------------
   Container — Three-Column Layout
   --------------------------------------------------------------------------- */

.wp-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0;
    height: calc(100vh - 80px);
    overflow: hidden;
}

@media (max-width: 768px) {
    .wp-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .wp-sidebar {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
   Sidebar — History List
   --------------------------------------------------------------------------- */

.wp-sidebar {
    padding: 20px 16px;
    border-right: 1px solid var(--line-subtle);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.15);
}

.wp-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wp-history-item {
    position: relative;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.wp-history-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line-subtle);
}

.wp-history-item .history-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 4px;
    transition: opacity 0.15s;
    color: var(--text-muted);
}

.wp-history-item:hover .history-delete-btn {
    opacity: 0.6;
}

.wp-history-item .history-delete-btn:hover {
    opacity: 1;
    color: var(--danger);
}

.wp-history-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-default);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 24px;
}

.wp-history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-subtle);
    margin-top: 4px;
}

/* ---------------------------------------------------------------------------
   Main Content Area
   --------------------------------------------------------------------------- */

.wp-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------------------------------------------------------------------------
   Input Section
   --------------------------------------------------------------------------- */

.wp-input-section {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line-subtle);
    background: rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.wp-input-section .input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wp-input-section .input-group label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.wp-input {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-subtle);
    border-radius: 8px;
    color: var(--text-default);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    width: 100%;
    min-width: 300px;
}

.wp-input:focus {
    outline: none;
    border-color: #A78BFA;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}

.wp-select {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-subtle);
    border-radius: 8px;
    color: var(--text-default);
    font-size: 0.85rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.wp-generate-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #7C3AED, #A78BFA);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.wp-generate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.wp-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wp-generate-btn .btn-icon {
    font-size: 1rem;
}

/* ---------------------------------------------------------------------------
   Render Area
   --------------------------------------------------------------------------- */

#wp-render-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ---------------------------------------------------------------------------
   Empty State
   --------------------------------------------------------------------------- */

.wp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.wp-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 32px;
    max-width: 500px;
}

@media (max-width: 600px) {
    .wp-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.wp-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border-radius: 12px;
    background: rgba(167, 139, 250, 0.05);
    border: 1px solid rgba(167, 139, 250, 0.1);
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.wp-feature:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.2);
}

.wp-feature-icon {
    font-size: 1.2rem;
}

/* ---------------------------------------------------------------------------
   Loading / Progress Tracker
   --------------------------------------------------------------------------- */

.wp-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px;
}

.wp-progress-tracker {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 280px;
}

.wp-phase {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}

.wp-phase-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 60px;
}

.wp-phase-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--line-subtle);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.wp-phase-dot.active {
    background: #7C3AED;
    border-color: #A78BFA;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.4);
    animation: wp-pulse 2s infinite;
}

.wp-phase-dot.completed {
    background: var(--success);
    border-color: var(--success);
}

.wp-phase-line {
    width: 2px;
    flex: 1;
    background: var(--line-subtle);
    min-height: 30px;
}

.wp-phase-info {
    padding-top: 0;
}

.wp-phase-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-default);
    margin-bottom: 2px;
}

.wp-phase-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

@keyframes wp-pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(124, 58, 237, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.6);
    }
}

/* ---------------------------------------------------------------------------
   Document Preview
   --------------------------------------------------------------------------- */

.wp-document {
    max-width: 960px;
    margin: 0 auto;
    animation: fadeInDoc 0.4s ease;
}

@keyframes fadeInDoc {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Actions Bar */
.wp-actions-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: flex-end;
}

/* Document Header */
.wp-doc-header {
    padding: 32px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(167, 139, 250, 0.04));
    border: 1px solid rgba(167, 139, 250, 0.15);
    border-radius: 16px;
    margin-bottom: 24px;
}

.wp-doc-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-default);
    line-height: 1.3;
    margin: 0 0 16px 0;
}

.wp-doc-abstract {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
    border-left: 3px solid #A78BFA;
    background: rgba(167, 139, 250, 0.04);
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
}

.wp-doc-meta {
    display: flex;
    gap: 16px;
    font-size: 0.7rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Table of Contents */
.wp-toc {
    padding: 24px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--line-subtle);
    border-radius: 12px;
    margin-bottom: 32px;
}

.wp-toc-title {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

.wp-toc-list {
    padding-left: 20px;
    margin: 0;
}

.wp-toc-item {
    margin-bottom: 6px;
}

.wp-toc-link {
    color: #A78BFA;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s;
    cursor: pointer;
}

.wp-toc-link:hover {
    color: #C4B5FD;
    text-decoration: underline;
}

/* Sections */
.wp-sections-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.wp-section {
    padding: 28px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line-subtle);
    border-radius: 12px;
    transition: border-color 0.2s;
}

.wp-section:hover {
    border-color: rgba(167, 139, 250, 0.2);
}

.wp-section-title {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-default);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-subtle);
}

.wp-section-number {
    color: #A78BFA;
    font-family: var(--font-display);
    margin-right: 8px;
}

.wp-section-content {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.wp-section-content p {
    margin-bottom: 12px;
    text-align: justify;
}

.wp-section-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-default);
    margin: 20px 0 10px;
}

.wp-section-content ul,
.wp-section-content ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.wp-section-content li {
    margin-bottom: 6px;
}

.wp-section-content blockquote {
    border-left: 3px solid #A78BFA;
    padding-left: 16px;
    margin: 16px 0;
    font-style: italic;
    color: var(--text-subtle);
}

/* Works Cited */
.wp-works-cited {
    margin-top: 32px;
    padding: 28px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--line-subtle);
    border-radius: 12px;
}

.wp-works-cited-content {
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.wp-works-cited-content p {
    padding-left: 32px;
    text-indent: -32px;
    margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   Action Buttons (reuse existing patterns)
   --------------------------------------------------------------------------- */

.wp-actions-bar .action-btn {
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--line-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}

.wp-actions-bar .action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--text-default);
}