/* ============================================================
   Repositories Page
   ============================================================ */

/* ---- Heading Row ---- */
.repo-heading {
    display: flex;
    align-items: stretch;
    gap: 2.5rem;
    margin-top: var(--crypto-spacing-xl);
}

/* Left: avatar + workspace details */
.repo-heading-info {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-md);
    min-width: 0;
    flex: 1;
}

.repo-heading-info .avatar {
    flex-shrink: 0;
}

.repo-heading-details {
    min-width: 0;
}

.repo-heading-name-row {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-sm);
    margin-bottom: 0.25rem;
}

.repo-heading-name {
    font-weight: 600;
    font-size: var(--crypto-font-size-2xl);
    color: var(--crypto-text-primary);
    line-height: var(--crypto-line-height-tight);
}

/* Meta row: github · location · company · blog */
.repo-heading-meta {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-sm);
    flex-wrap: wrap;
}

.repo-heading-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--crypto-font-size-sm);
    color: var(--crypto-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

a.repo-heading-meta-item:hover {
    color: var(--crypto-accent-400);
}

.repo-heading-meta-dot {
    color: var(--crypto-text-muted);
    font-size: var(--crypto-font-size-lg);
    line-height: 1;
    user-select: none;
}

/* Description */
.repo-heading-desc {
    font-size: var(--crypto-font-size-sm);
    color: var(--crypto-text-secondary);
    line-height: var(--crypto-line-height-normal);
    margin: 0.375rem 0 0;
    max-width: 92ch;
}

/* Right column: stats + quotas */
.repo-heading-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    gap: var(--crypto-spacing-md);
    flex-shrink: 0;
}

/* Stats with icons */
.repo-heading-stats {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-md);
}

.repo-heading-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--crypto-font-size-base);
    color: var(--crypto-text-secondary);
    white-space: nowrap;
}

.repo-heading-stat strong {
    font-weight: 700;
    font-size: var(--crypto-font-size-lg);
    color: var(--crypto-text-primary);
}

.repo-heading-stat-icon {
    font-size: 1rem;
    color: var(--crypto-text-muted);
}

.repo-heading-stat-icon--lg {
    font-size: 1.25rem;
    color: var(--crypto-text-muted);
}

.repo-heading-stat-dot {
    color: var(--crypto-text-muted);
    font-size: var(--crypto-font-size-lg);
    line-height: 1;
    user-select: none;
}

/* Quota Bars */
.repo-heading-quotas {
    display: flex;
    gap: var(--crypto-spacing-lg);
}

.repo-quota {
    flex: 1;
    min-width: 180px;
}

.repo-quota-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}

.repo-quota-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--crypto-font-size-xs);
    font-weight: 500;
    color: var(--crypto-text-secondary);
}

.repo-quota-label i {
    font-size: 0.75rem;
    color: var(--crypto-text-muted);
}

.repo-quota-count {
    font-size: var(--crypto-font-size-xs);
    font-weight: 600;
    color: var(--crypto-text-primary);
}

.repo-quota-bar {
    height: 5px;
    border-radius: var(--crypto-radius-full);
    background: var(--crypto-bg-secondary);
    overflow: hidden;
}

.repo-quota-fill {
    height: 100%;
    border-radius: var(--crypto-radius-full);
    transition: width 0.6s ease;
    min-width: 2px;
}

.repo-quota-fill--public {
    background: var(--crypto-gradient-tech);
}

.repo-quota-fill--private {
    background: var(--crypto-gradient-success);
}

/* Actions: sync button + last sync (top right, in title row) */
.repo-heading-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
}

.repo-heading-sync {
    font-size: var(--crypto-font-size-xs);
    color: var(--crypto-text-muted);
    white-space: nowrap;
}

/* ---- Section Divider ---- */
.repo-section-divider {
    height: 1px;
    background: var(--crypto-border-default, var(--crypto-border));
    margin-bottom: var(--crypto-spacing-lg);
}

/* ---- Toolbar ---- */
.repo-toolbar {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-md);
    flex-wrap: wrap;
}

.repo-toolbar .repo-search {
    flex: 0 1 280px;
    min-width: 180px;
}

.repo-toolbar-filters {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-xs);
    flex-wrap: wrap;
}

.repo-toolbar-count {
    margin-left: auto;
    font-size: var(--crypto-font-size-sm);
    color: var(--crypto-text-muted);
    white-space: nowrap;
}

/* ---- Filter Pills ---- */
.filter-pill {
    background: var(--crypto-bg-secondary);
    color: var(--crypto-text-secondary);
    border: 1px solid var(--crypto-border-default, var(--crypto-border));
    border-radius: var(--crypto-radius-full);
    padding: 0.375rem 1rem;
    font-size: var(--crypto-font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.4;
    text-decoration: none;
}

.filter-pill:hover {
    background: var(--crypto-bg-hover);
    border-color: var(--crypto-border-emphasis, var(--crypto-border-hover));
    color: var(--crypto-text-primary);
    text-decoration: none;
}

.filter-pill.active {
    background: var(--crypto-accent-alpha-20, rgba(120, 121, 246, 0.12));
    border-color: var(--crypto-accent-500, var(--crypto-accent));
    color: var(--crypto-accent-500, var(--crypto-accent));
    font-weight: 600;
}

[data-bs-theme="dark"] .filter-pill.active {
    color: var(--crypto-accent-300);
}

.filter-pill .pill-count {
    font-size: var(--crypto-font-size-xs);
    opacity: 0.7;
    margin-left: 0.125rem;
}

/* ---- Repository Grid ---- */
.repo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* ---- Repository Card ---- */
.repo-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem;
    border-radius: var(--crypto-radius-md);
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    transition:
        transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.25s ease;
    border: 1px solid var(--crypto-border-default, var(--crypto-border));
    position: relative;
    overflow: hidden;
}

/* Invisible overlay link — makes the entire card clickable */
.repo-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

[data-bs-theme="light"] .repo-card {
    background: #ffffff;
}

[data-bs-theme="dark"] .repo-card {
    background: var(--crypto-bg-elevated, #14131c);
}

/* Gradient top border — hidden by default, revealed on hover */
.repo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--crypto-gradient-tech);
    border-radius: var(--crypto-radius-md) var(--crypto-radius-md) 0 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.repo-card:hover {
    transform: translateY(-3px);
    border-color: var(--crypto-accent-alpha-30, rgba(120, 121, 246, 0.3));
    box-shadow:
        var(--crypto-shadow-md, 0 4px 16px rgba(0, 0, 0, 0.1)),
        var(--crypto-glow-accent-sm, 0 0 16px rgba(120, 121, 246, 0.12));
}

.repo-card:hover::before {
    opacity: 1;
}

/* Claimed card — always-visible green gradient top border */
.repo-card--claimed::before {
    background: var(--crypto-gradient-success);
    opacity: 1;
}

.repo-card:hover .repo-card-name {
    color: var(--crypto-accent-400);
}

/* ---- Card Internal Components ---- */
.repo-card-body {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    flex-grow: 1;
}

.repo-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--crypto-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    background: var(--crypto-gradient-tech);
    color: #ffffff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.repo-card-info {
    flex: 1;
    min-width: 0;
}

.repo-card-name {
    font-size: var(--crypto-font-size-base);
    font-weight: 600;
    color: var(--crypto-text-primary);
    margin-bottom: 0.25rem;
    transition: color 0.2s ease;
}

.repo-card-visibility-icon {
    font-size: 0.75rem;
    color: var(--crypto-text-muted);
    margin-right: 0.25rem;
    opacity: 0.7;
}

.repo-card-desc {
    font-size: var(--crypto-font-size-sm);
    color: var(--crypto-text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    line-height: 1.5;
}

.repo-card-desc--empty {
    font-style: italic;
    color: var(--crypto-text-muted);
}

.repo-card-spacer {
    flex: 1;
}

.repo-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.75rem -1.25rem -1.25rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--crypto-border-default);
    font-size: var(--crypto-font-size-sm);
}

.repo-card-snapshots {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--crypto-text-muted);
    font-size: var(--crypto-font-size-sm);
}

.repo-card-external {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--crypto-text-muted);
    text-decoration: none !important;
    cursor: pointer;
    transition: color 0.2s ease;
}

.repo-card-external:hover {
    color: var(--crypto-accent-400);
}

/* ---- Pagination ---- */
.repo-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.repo-pagination .page-link {
    color: var(--crypto-text-secondary);
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    border-radius: var(--crypto-radius-sm, 0.25rem);
    transition: all 0.2s ease;
    font-size: var(--crypto-font-size-sm);
}

.repo-pagination .page-link:hover {
    color: var(--crypto-accent-500);
    background: var(--crypto-accent-alpha-10, rgba(120, 121, 246, 0.06));
}

.repo-pagination .page-item.active .page-link {
    background: var(--crypto-accent-500);
    color: #fff;
}

.repo-pagination .page-item.disabled .page-link {
    color: var(--crypto-text-muted);
    background: transparent;
    opacity: 0.5;
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .repo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .repo-heading {
        flex-direction: column;
    }

    .repo-heading-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .repo-heading-name-row {
        justify-content: center;
        flex-wrap: wrap;
    }

    .repo-heading-meta {
        justify-content: center;
    }

    .repo-heading-right {
        align-items: center;
        width: 100%;
    }

    .repo-heading-stats {
        flex-wrap: wrap;
        gap: var(--crypto-spacing-sm);
        justify-content: center;
    }

    .repo-heading-quotas {
        flex-direction: column;
        gap: var(--crypto-spacing-sm);
        width: 100%;
    }

    .repo-quota {
        max-width: none;
    }

    .repo-heading-actions {
        display: flex !important;
        align-items: stretch !important;
        width: 100%;
    }

    .repo-heading-actions .btn {
        width: 100%;
    }

    .repo-heading-sync {
        text-align: center;
    }

    .repo-grid {
        grid-template-columns: 1fr;
    }

    .repo-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .repo-toolbar .repo-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .repo-toolbar-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        scrollbar-width: none;
        max-width: 100%;
    }

    .repo-toolbar-filters::-webkit-scrollbar {
        display: none;
    }

    .repo-toolbar-filters .filter-pill {
        flex-shrink: 0;
    }

    .repo-toolbar-count {
        margin-left: 0;
        text-align: center;
    }

    .repo-pagination {
        flex-direction: column;
        gap: var(--crypto-spacing-sm);
        align-items: center;
    }

    .repo-pagination .pagination {
        margin-left: 0 !important;
    }
}

/* ============================================================
   Repository Detail Page
   ============================================================ */

/* ---- Breadcrumb ---- */
.repo-breadcrumb {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--crypto-spacing-sm);
}

.repo-breadcrumb a {
    color: var(--crypto-text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.repo-breadcrumb a:hover {
    color: var(--crypto-text-secondary);
}

.repo-breadcrumb .repo-breadcrumb-separator {
    color: var(--crypto-text-muted);
}

.repo-breadcrumb .repo-breadcrumb-current {
    color: var(--crypto-text-muted);
    font-weight: 500;
}


/* ---- Activity Timeline ---- */
.activity-timeline {
    position: relative;
    padding-left: 3rem;
}

/* Vertical line — centered behind the icons */
.activity-timeline::before {
    content: '';
    position: absolute;
    left: calc(1.0625rem - 1px);
    top: 0.25rem;
    bottom: 0.25rem;
    width: 2px;
    background: var(--crypto-border-default, var(--crypto-border));
}

.activity-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
}

.activity-item:last-child {
    padding-bottom: 0;
}

.activity-icon {
    position: absolute;
    left: -3rem;
    top: 0;
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
    z-index: 1;
}

.activity-icon.bg-orange-lt {
    background: rgb(180, 120, 10) !important;
    color: #fff !important;
}

.activity-icon.bg-green-lt {
    background: rgb(34, 140, 50) !important;
    color: #fff !important;
}

.activity-icon.bg-blue-lt {
    background: rgb(32, 107, 196) !important;
    color: #fff !important;
}

.activity-icon.bg-purple-lt {
    background: rgb(130, 40, 220) !important;
    color: #fff !important;
}

.activity-content {
    flex: 1;
    min-width: 0;
    padding-top: 0.25rem;
}

.activity-time {
    font-size: 0.6875rem;
    color: var(--crypto-text-muted);
    margin-bottom: 0.125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.activity-content .fw-semibold {
    font-size: var(--crypto-font-size-sm);
    color: var(--crypto-text-primary);
}

.activity-content .text-muted.small {
    font-size: var(--crypto-font-size-xs);
}

/* ---- Empty States ---- */
.section-anchor .empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
}

.section-anchor .empty .empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    max-width: 280px;
    flex-shrink: 0;
    margin: 0 auto 1rem;
}

.section-anchor .empty .empty-title {
    font-size: var(--crypto-font-size-lg);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.section-anchor .empty .empty-subtitle {
    max-width: 40ch;
    margin: 0 auto;
}

/* ---- Section Anchors ---- */
.section-anchor {
    scroll-margin-top: 7.5rem;
}

.section-anchor+.section-anchor {
    margin-top: var(--crypto-spacing-xl);
}

/* ---- Lightweight Section Headers ---- */
.repo-section-header {
    display: flex;
    align-items: center;
    gap: var(--crypto-spacing-sm);
    padding-bottom: var(--crypto-spacing-md);
    margin-bottom: var(--crypto-spacing-lg);
    border-bottom: 1px solid var(--crypto-border-default, var(--crypto-border));
}

.repo-section-header h3 {
    font-size: var(--crypto-font-size-base);
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--crypto-text-primary);
}

.repo-section-header h3 i {
    font-size: 0.875rem;
}

.repo-section-header .badge {
    margin-left: auto;
}

/* ---- Hero Background (private pages) ---- */

/* Dark theme: subtle CSS-only background (constellation/neurone feel) */
.wsp-hero--page {
    background:
        radial-gradient(ellipse 60% 80% at 20% 15%, rgba(120, 121, 246, 0.18) 0%, transparent 65%),
        radial-gradient(ellipse 50% 70% at 80% 80%, rgba(200, 140, 220, 0.14) 0%, transparent 65%),
        radial-gradient(ellipse 35% 50% at 50% 50%, rgba(120, 121, 246, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 100% 100% at 50% 50%, transparent 50%, rgba(10, 9, 18, 0.40) 100%),
        linear-gradient(135deg,
            rgba(120, 121, 246, 0.08) 0%,
            #14131c 40%,
            #13121b 60%,
            rgba(200, 140, 220, 0.06) 100%) !important;
}

/* Dark: no dot grid — constellation canvas provides texture */
.wsp-hero.wsp-hero--page::before {
    content: none;
}

/* Dark: bottom accent line */
.wsp-hero--page::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(120, 121, 246, 0.15) 25%,
        rgba(160, 122, 246, 0.15) 50%,
        rgba(251, 203, 245, 0.12) 75%,
        transparent);
    pointer-events: none;
}

/* Light theme: keep image-based background */
[data-bs-theme="light"] .wsp-hero--page {
    background: url('/assets/images/hero-bg.jpg') center/cover no-repeat !important;
}

[data-bs-theme="light"] .wsp-hero--page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: none;
    background: linear-gradient(135deg,
        rgba(120, 121, 246, 0.08) 0%,
        rgba(244, 243, 250, 0.75) 40%,
        rgba(244, 243, 250, 0.75) 60%,
        rgba(6, 182, 212, 0.06) 100%);
    z-index: 1;
}

[data-bs-theme="light"] .wsp-hero--page::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(120, 121, 246, 0.12) 25%,
        rgba(160, 122, 246, 0.12) 50%,
        rgba(6, 182, 212, 0.10) 75%,
        transparent);
    pointer-events: none;
    z-index: 2;
}

/* ---- Hero Button Visibility ---- */
.wsp-hero--page .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.wsp-hero--page .btn-outline-secondary:hover {
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12) !important;
}

[data-bs-theme="light"] .wsp-hero--page .btn-outline-secondary {
    border-color: rgba(0, 0, 0, 0.18) !important;
    color: rgba(0, 0, 0, 0.7) !important;
    background: rgba(0, 0, 0, 0.04) !important;
}

[data-bs-theme="light"] .wsp-hero--page .btn-outline-secondary:hover {
    border-color: rgba(0, 0, 0, 0.30) !important;
    color: rgba(0, 0, 0, 0.85) !important;
    background: rgba(0, 0, 0, 0.08) !important;
}