/* ============================================================
   ANALYSAURUS - STYLES
   Extends common.css + stable analysaurus patterns
   ============================================================ */

/* Header dino sticker: placed by hand, slightly crooked */
.header-logo {
    --sticker-tilt: 2deg;
    transform: rotate(var(--sticker-tilt));
}

/* ============================================================
   DROP ZONE
   ============================================================ */

/* The drop zone's look and motion are shared in common.css */

/* ============================================================
   FILE QUEUE
   ============================================================ */

.file-queue {
    margin-top: 1rem;
}

.file-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.file-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Folder group */
.file-group {
    margin-bottom: 0.5rem;
}

.file-group-header {
    font-family: var(--font-mono);   /* file names are data, in the terminal font */
    font-size: 0.75rem;
    color: var(--ink-a70);
    letter-spacing: 0.02em;
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.375rem;
    transition: background var(--dur-fast) var(--ease-standard);
}

.file-row:hover {
    background: var(--ink-a10);
}

.file-ext-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    background: var(--ink-a10);
    color: var(--ink-text);
    flex-shrink: 0;
}

.file-name {
    font-family: var(--font-mono);   /* file names are data, in the terminal font */
    font-size: 0.8rem;
    color: var(--ink-text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-a70);
    flex-shrink: 0;
}

.file-remove {
    font-size: 0.75rem;
    color: var(--ink-a60);
    cursor: pointer;
    padding: 0 0.25rem;
    flex-shrink: 0;
    transition: color var(--dur-fast) var(--ease-standard);
}

.file-remove:hover {
    color: var(--status-error);
}

/* Under each file: a line to say what to look for in it, in the queue's own quiet type */
.file-ask-row {
    padding: 0 0.5rem 0.4rem 2.75rem;   /* in from the badge, under the name */
}

.file-ask {
    width: 100%;
    padding: 0.25rem 0.5rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--ink-text);
    background: var(--paper-cream);
    border: 1px dashed var(--ink-a40);
    border-radius: 0.375rem;
    outline: none;
}

.file-ask:focus {
    border-style: solid;
    border-color: var(--green);
}

.file-ask::placeholder {
    color: var(--ink-a50);
}

/* A marked-up document from Lookasaurus that came with its original words */
.file-with-original {
    font-family: var(--font-body);
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    background: color-mix(in srgb, var(--green) 14%, var(--paper-cream));
    color: var(--ink-text);
    flex-shrink: 0;
}

/* ============================================================
   FILE NAVIGATOR (results mode)
   ============================================================ */

.file-navigator {
    max-height: 400px;
    overflow-y: auto;
}

.nav-file-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-standard);
    font-family: var(--font-mono);   /* file names are data, in the terminal font */
    font-size: 0.8rem;
    color: var(--ink-text);
}

.nav-file-row:hover {
    background: var(--ink-a10);
}

.nav-file-row.active {
    background: var(--ink-a20);
}

/* File status: a distinct icon shape per state, so status never relies on color alone */
.nav-file-row .status-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.status-pending {
    color: var(--ink-a60);
}

.status-analyzing {
    color: var(--status-warn);
    animation: pulse-dot 1s ease-in-out infinite;
}

.status-done {
    color: var(--status-ok);
}

.status-error {
    color: var(--status-error);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================================
   GENERAL SUMMARY BUTTON
   ============================================================ */

/* Color, shadow and hover come from btn-green in common.css; when the summary is ready
   the button lifts a little higher off the paper */
.general-summary-btn.active-glow {
    box-shadow: var(--shadow-paper-lift);
}

/* ============================================================
   RESULTS GRID (two-column on desktop)
   ============================================================ */

.results-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1rem;
    align-items: start;
}

/* ============================================================
   ANALYSIS BOXES (copied from stable)
   ============================================================ */

.analysis-box {
    border: 1px solid var(--ink-a40);
    border-radius: 0.75rem;
    background-color: var(--paper-cream);
    box-shadow: var(--shadow-sheet);
    overflow: hidden;
    transition: border-color var(--dur-base) var(--ease-standard);
}

.analysis-box:hover {
    border-color: var(--ink-a60);
}

.analysis-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(69, 26, 3, 0.06);
    cursor: pointer;
    user-select: none;
    transition: background var(--dur-base) var(--ease-standard);
}

.analysis-box-header:hover {
    background: var(--ink-a10);
}

.analysis-box-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-text);
}

.analysis-box-toggle {
    color: var(--ink-text);
    font-size: 0.75rem;
    transition: transform var(--dur-base) var(--ease-standard);
}

.analysis-box-toggle.collapsed {
    transform: rotate(-90deg);
}

.analysis-box-content {
    padding: 1rem;
    color: var(--ink-text);
    font-size: 15px;
    line-height: 1.6;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height var(--dur-slow) var(--ease-standard), padding var(--dur-slow) var(--ease-standard), opacity var(--dur-slow) var(--ease-standard);
    opacity: 1;
}

.analysis-box-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.analysis-box-content .box-label {
    font-weight: 600;
    color: var(--ink-a70);
    margin-right: 0.25rem;
}

.analysis-box-content .box-text {
    color: var(--ink-text);
    white-space: pre-wrap;   /* the AI writes line breaks; they are kept, as Diffasaurus keeps them */
}

.analysis-box-content .box-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.analysis-box-content .box-list li {
    padding: 0.25rem 0 0.25rem 1rem;
    position: relative;
    color: var(--ink-text);
}

.analysis-box-content .box-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--ink-a70);
}

.analysis-box-content .box-step {
    padding: 0.4rem 0;
}

.analysis-box-content .box-subsection {
    margin-top: 0.75rem;
}

.analysis-box-content .box-subsection-title {
    font-weight: 600;
    color: var(--ink-a70);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.analysis-box.method-box {
    border-left: 3px solid var(--ink-a50);
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--spinner-track);
    border-top-color: var(--ink-900);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .analysis-box-header {
        padding: 0.5rem 0.75rem;
    }

    .analysis-box-title {
        font-size: 0.8rem;
    }

    .analysis-box-content {
        padding: 0.75rem;
        font-size: 0.8rem;
        line-height: 1.5;
    }

    .results-toolbar {
        flex-direction: column !important;
        gap: 0.5rem;
        align-items: stretch !important;
    }

    .results-toolbar button,
    .results-toolbar a.btn-cream {
        font-size: 0.75rem !important;
        padding: 0.375rem 0.625rem !important;
    }
}

@media (max-width: 480px) {
    .analysis-box-header {
        padding: 0.375rem 0.5rem;
    }

    .analysis-box-title {
        font-size: 0.75rem;
    }

    .analysis-box-content {
        padding: 0.5rem;
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .analysis-box.method-box {
        border-left-width: 2px;
    }
}

/* The Export As menu on the results toolbar: the same paper as the key menu and the Export As
   menu on Lookasaurus. Solid cream, thin ink edge, as wide as its longest line, opening from
   the button's left edge */
.export-menu {
    left: 0;
    width: max-content;
    min-width: 100%;
    background: var(--paper-cream);
    border-color: rgba(69, 26, 3, 0.25);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-paper-lift);
}
