/* ResearchForge AI - application styling
   A clean, academic, professional layout with a fixed sidebar. */

:root {
    --rf-sidebar-width: 250px;
    --rf-primary: #1d3557;
    --rf-primary-dark: #14253f;
    --rf-accent: #2a9d8f;
    --rf-bg: #f4f6f9;
    --rf-border: #e2e6ec;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--rf-bg);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: #25303b;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
    width: var(--rf-sidebar-width);
    background: linear-gradient(180deg, var(--rf-primary) 0%, var(--rf-primary-dark) 100%);
    color: #dfe7f1;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand i {
    color: var(--rf-accent);
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #c4d0e0;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--rf-accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-group-label {
    padding: 0.85rem 0.95rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar-group-label:first-child {
    padding-top: 0.35rem;
}

/* --------------------------------------------------------- Workflow bar */
.workflow-bar {
    background: #fff;
    border: 1px solid var(--rf-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}

.workflow-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.workflow-project {
    font-size: 0.95rem;
    color: var(--rf-primary);
}

.workflow-project i {
    color: var(--rf-accent);
}

.workflow-steps {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    overflow-x: auto;
}

.wf-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 0;
    min-width: max-content;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--rf-border);
    background: #f8fafc;
    color: #4a5765;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wf-step:hover {
    border-color: var(--rf-accent);
    color: var(--rf-primary);
}

.wf-step-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.wf-step.is-current {
    background: var(--rf-primary);
    border-color: var(--rf-primary);
    color: #fff;
    font-weight: 600;
}

.wf-step.is-current .wf-step-marker {
    background: var(--rf-accent);
    color: #fff;
}

.wf-step.is-done {
    background: #eef7f5;
    border-color: #cfeae5;
}

.wf-step.is-done .wf-step-marker {
    background: var(--rf-accent);
    color: #fff;
}

/* ------------------------------------------------------------- Main area */
.app-main {
    flex: 1;
    margin-left: var(--rf-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--rf-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.topbar-user {
    margin-left: auto;
}

.app-content {
    padding: 1.5rem;
    flex: 1;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--rf-border);
    font-size: 0.85rem;
    color: #6b7785;
    background: #fff;
}

/* ------------------------------------------------------------- Components */
.stat-card {
    border: 1px solid var(--rf-border);
    border-radius: 12px;
    background: #fff;
    padding: 1.1rem 1.25rem;
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--rf-primary);
    line-height: 1;
}

.stat-card .stat-label {
    color: #6b7785;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .stat-icon {
    font-size: 1.6rem;
    color: var(--rf-accent);
}

.card {
    border: 1px solid var(--rf-border);
    border-radius: 12px;
}

.integrity-banner {
    border-left: 4px solid var(--rf-accent);
    background: #eef7f5;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* ----------------------------------------------------------- Dashboard */
.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #1d3557 0%, #264a73 55%, #2a9d8f 100%);
    color: #fff;
    box-shadow: 0 12px 30px rgba(29, 53, 87, 0.18);
}

.dashboard-hero-kicker {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

.dashboard-hero-title {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0;
}

.dashboard-hero-lead {
    opacity: 0.92;
    max-width: 42rem;
}

.dashboard-hero .btn-outline-secondary,
.dashboard-hero .btn-outline-primary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.dashboard-hero .btn-outline-secondary:hover,
.dashboard-hero .btn-outline-primary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.dashboard-featured {
    border: 1px solid #cfeae5;
    background: linear-gradient(180deg, #ffffff 0%, #f8fcfb 100%);
}

.dashboard-readiness-ring {
    --progress: 0;
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(closest-side, #fff 72%, transparent 73% 100%),
        conic-gradient(var(--rf-accent) calc(var(--progress) * 1%), #e2e8f0 0);
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.dashboard-readiness-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--rf-primary);
    line-height: 1;
}

.dashboard-readiness-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7785;
}

.dashboard-wf-mini {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
}

.dashboard-wf-dot {
    flex: 1 1 0;
    min-width: 4.5rem;
    text-align: center;
    padding: 0.45rem 0.35rem;
    border-radius: 999px;
    font-size: 0.72rem;
    text-decoration: none;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.dashboard-wf-dot.is-done {
    background: #eef7f5;
    border-color: #b7e4de;
    color: var(--rf-primary);
    font-weight: 600;
}

.dashboard-wf-dot span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-stat-card {
    display: block;
    height: 100%;
    padding: 1rem 1rem 0.95rem;
    border-radius: 14px;
    border: 1px solid var(--rf-border);
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(29, 53, 87, 0.08);
    border-color: #cfd8e3;
    color: inherit;
}

.dashboard-stat-icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.dashboard-stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--rf-primary);
}

.dashboard-stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7785;
    margin-top: 0.2rem;
}

.dashboard-stat-primary .dashboard-stat-icon { background: #e8eef7; color: #1d3557; }
.dashboard-stat-success .dashboard-stat-icon { background: #e8f7f3; color: #2a9d8f; }
.dashboard-stat-teal .dashboard-stat-icon { background: #e6f7f8; color: #168a8f; }
.dashboard-stat-indigo .dashboard-stat-icon { background: #eceeff; color: #4f46e5; }
.dashboard-stat-amber .dashboard-stat-icon { background: #fff4df; color: #b45309; }
.dashboard-stat-slate .dashboard-stat-icon { background: #eef2f7; color: #475569; }

.dashboard-project-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dashboard-project-item {
    display: flex;
    gap: 0.85rem;
    align-items: stretch;
    padding: 1rem;
    border: 1px solid var(--rf-border);
    border-radius: 12px;
    background: #fcfdfe;
}

.dashboard-project-main {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-project-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
}

.dashboard-project-readiness {
    min-width: 3rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
}

.dashboard-project-readiness.readiness-high {
    background: #e8f7f3;
    color: #1f7a6d;
}

.dashboard-project-readiness.readiness-mid {
    background: #fff4df;
    color: #b45309;
}

.dashboard-project-readiness.readiness-low {
    background: #fdecec;
    color: #b42318;
}

.dashboard-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-bottom: 0.55rem;
}

.dashboard-project-progress {
    height: 0.45rem;
    background: #e9eef3;
}

.dashboard-attention-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dashboard-attention-link {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--rf-border);
    background: #fafbfc;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.dashboard-attention-link:hover {
    background: #f4f8fb;
    border-color: #cfd8e3;
    color: inherit;
}

.dashboard-attention-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff4df;
    color: #b45309;
    flex-shrink: 0;
}

.dashboard-attention-item.severity-info .dashboard-attention-icon {
    background: #e8eef7;
    color: #1d3557;
}

.dashboard-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dashboard-activity-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.dashboard-activity-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef7f5;
    color: var(--rf-accent);
    flex-shrink: 0;
}

.dashboard-empty-icon {
    font-size: 3rem;
    color: #b8c5d3;
}

@media (max-width: 767.98px) {
    .dashboard-project-item {
        flex-direction: column;
    }

    .dashboard-project-actions {
        flex-direction: row;
    }

    .dashboard-hero-title {
        font-size: 1.35rem;
    }
}

.section-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* --------------------------------------------------------- Auth screens */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--rf-primary) 0%, var(--rf-primary-dark) 100%);
    padding: 1.5rem;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 2.25rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--rf-primary);
    margin-bottom: 0.25rem;
}

.auth-brand i {
    color: var(--rf-accent);
}

/* --------------------------------------------------------- Live log panels */
.rf-live-log-panel {
    height: 280px;
    overflow: hidden;
    padding: 0;
}

.rf-live-log {
    height: 280px;
    overflow-y: auto;
    padding: 1rem;
    margin: 0;
}

/* --------------------------------------------------------- Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }
}
