/* APHRC Git Sync – Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=DM+Sans:wght@400;500;600&display=swap');

.aphrc-repos-wrapper {
    --accent: #1D9E75;
    --accent-light: #E1F5EE;
    --accent-dark: #0F6E56;
    --accent-dim: rgba(29,158,117,.08);
    --accent-border: rgba(29,158,117,.35);
    --mono: 'IBM Plex Mono', monospace;
    --sans: 'DM Sans', sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --bg-primary: #fff;
    --bg-secondary: #f7f8fa;
    --bg-tertiary: #f0f1f3;
    --border-primary: #c1c5cc;
    --border-secondary: #d8dbe0;
    --border-tertiary: #e8eaed;
    --text-primary: #1a1d21;
    --text-secondary: #5f6368;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 1.25rem 0;
}
.aphrc-repos-wrapper *, .aphrc-repos-wrapper *::before, .aphrc-repos-wrapper *::after {
    box-sizing: border-box;
}

/* ── ORG HEADER ── */
.aphrc-org-header {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 0.5px solid var(--border-tertiary);
    border-radius: var(--radius);
    margin-bottom: 12px;
}
.aphrc-org-avatar {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; object-fit: cover;
}
.aphrc-org-avatar--initials {
    background: linear-gradient(135deg, #1D9E75, #0a6e50);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 600; color: #fff;
    font-family: var(--sans); letter-spacing: -1px;
}
.aphrc-org-info { flex: 1; min-width: 0; }
.aphrc-org-name { font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.aphrc-org-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aphrc-org-pills { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.aphrc-org-pill {
    font-size: 11px; padding: 2px 9px; border-radius: 20px;
    background: var(--bg-secondary); border: 0.5px solid var(--border-tertiary);
    color: var(--text-secondary); font-weight: 500;
}
.aphrc-org-pill strong { color: var(--text-primary); font-weight: 600; }
.aphrc-sync-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 0.5px solid var(--border-secondary);
    border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
    cursor: pointer; background: var(--bg-primary); color: var(--text-primary);
    white-space: nowrap; font-family: var(--sans); transition: background .15s, border-color .15s;
}
.aphrc-sync-btn:hover { background: var(--bg-secondary); border-color: var(--border-primary); }
.aphrc-sync-btn svg { color: var(--accent); }
.aphrc-sync-btn.syncing svg { animation: aphrc-spin .7s linear infinite; }
@keyframes aphrc-spin { to { transform: rotate(360deg); } }

/* ── TOOLBAR ── */
.aphrc-repos-wrapper .aphrc-toolbar {
    display: flex; gap: 10px; margin-bottom: 12px; align-items: stretch;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-tertiary);
    border-radius: var(--radius);
}
.aphrc-repos-wrapper .aphrc-search-wrap {
    flex: 1; position: relative; display: flex; align-items: center; min-width: 0;
}
.aphrc-repos-wrapper .aphrc-search-icon {
    position: absolute; left: 12px; color: var(--text-secondary); pointer-events: none; z-index: 1;
}
.aphrc-repos-wrapper .aphrc-search-box {
    width: 100% !important;
    padding: 9px 40px 9px 38px !important;
    border: 1px solid var(--border-secondary) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    outline: none !important;
    font-family: var(--sans) !important;
    transition: border-color .15s, box-shadow .15s, background .15s !important;
    line-height: 1.4 !important;
    height: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
}
.aphrc-repos-wrapper .aphrc-search-box::placeholder {
    color: var(--text-secondary) !important; opacity: .7;
}
.aphrc-repos-wrapper .aphrc-search-box:focus {
    border-color: var(--accent-border) !important;
    box-shadow: 0 0 0 3px var(--accent-dim) !important;
    background: var(--bg-primary) !important;
}
.aphrc-repos-wrapper .aphrc-search-shortcut {
    position: absolute; right: 10px; pointer-events: none;
    display: flex; align-items: center;
}
.aphrc-repos-wrapper .aphrc-search-shortcut kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px;
    font-family: var(--sans); font-size: 11px; font-weight: 500;
    color: var(--text-secondary); background: var(--bg-primary);
    border: 1px solid var(--border-secondary); border-radius: 4px;
    line-height: 1; box-shadow: 0 1px 0 var(--border-tertiary);
}

/* Filter groups */
.aphrc-repos-wrapper .aphrc-filter-group {
    position: relative; display: flex; align-items: center; flex-shrink: 0;
}
.aphrc-repos-wrapper .aphrc-filter-group-icon {
    position: absolute; left: 10px; color: var(--text-secondary);
    pointer-events: none; z-index: 1;
}
.aphrc-repos-wrapper .aphrc-filter-select {
    padding: 9px 32px 9px 32px !important;
    border: 1px solid var(--border-secondary) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    outline: none !important;
    font-family: var(--sans) !important;
    transition: border-color .15s, background .15s !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235f6368' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    line-height: 1.4 !important;
    height: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    white-space: nowrap;
}
.aphrc-repos-wrapper .aphrc-filter-select:hover {
    border-color: var(--border-primary) !important;
    background: var(--bg-tertiary) !important;
}
.aphrc-repos-wrapper .aphrc-filter-select:focus {
    border-color: var(--accent-border) !important;
    box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

.aphrc-repos-wrapper .aphrc-results-meta {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px; padding: 0 2px;
}
.aphrc-repos-wrapper .aphrc-results-meta span { font-weight: 600; color: var(--text-primary); }

/* ── WORKSPACE ── */
.aphrc-workspace { display: flex; gap: 12px; align-items: flex-start; }
.aphrc-list-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; transition: flex .2s; }
.aphrc-list-col.sticky {
    flex: 0 0 320px; position: sticky; top: 0;
    max-height: 100vh; overflow-y: auto; padding-right: 2px; padding-bottom: 8px;
}
.aphrc-list-col.sticky::-webkit-scrollbar { width: 3px; }
.aphrc-list-col.sticky::-webkit-scrollbar-thumb { background: var(--border-secondary); border-radius: 4px; }

/* ── REPO CARD ── */
.aphrc-repo-card {
    background: var(--bg-primary);
    border: 0.5px solid var(--border-tertiary); border-radius: var(--radius);
    padding: 12px 14px; cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    position: relative; border-left: 3px solid transparent;
}
.aphrc-repo-card:hover { border-color: var(--border-secondary); background: var(--bg-secondary); }
.aphrc-repo-card:hover .aphrc-repo-arrow { opacity: 1; transform: translateX(0); }
.aphrc-repo-card.active { border-color: var(--accent-border); border-left: 3px solid var(--accent); background: var(--accent-dim); }

.aphrc-repo-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.aphrc-repo-name-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.aphrc-repo-icon { flex-shrink: 0; opacity: .6; }
.aphrc-repo-name {
    font-size: 13px; font-weight: 600; color: var(--accent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.1px;
}
.aphrc-repo-card.active .aphrc-repo-name { color: var(--accent-dark); }
.aphrc-repo-arrow {
    opacity: 0; transform: translateX(-4px);
    transition: opacity .15s, transform .15s;
    color: var(--text-secondary); flex-shrink: 0;
}

.aphrc-lang-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 500; color: var(--text-secondary);
    background: var(--bg-secondary); border: 0.5px solid var(--border-tertiary);
    padding: 2px 7px; border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.aphrc-lang-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.aphrc-repo-desc {
    font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin: 6px 0 8px;
}
.aphrc-repo-desc.clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.aphrc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.aphrc-tag {
    font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 20px;
    background: var(--accent-light); color: var(--accent-dark); border: 0.5px solid transparent;
}
.aphrc-tag.muted { background: var(--bg-secondary); color: var(--text-secondary); border-color: var(--border-tertiary); }

.aphrc-repo-footer { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-secondary); }
.aphrc-repo-footer .sep { width: 1px; height: 10px; background: var(--border-tertiary); }
.aphrc-star { color: #BA7517; font-size: 11px; }

/* ── DETAIL PANEL ── */
.aphrc-detail-col {
    flex: 0 0 calc(100% - 332px); display: none; flex-direction: column;
    border-radius: var(--radius); overflow: hidden;
    border: 0.5px solid var(--border-tertiary); background: var(--bg-primary);
}
.aphrc-detail-col.visible { display: flex; animation: aphrc-slideIn .18s ease; }
@keyframes aphrc-slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

.aphrc-detail-header { padding: 0; border-bottom: 0.5px solid var(--border-tertiary); }
.aphrc-detail-hero { padding: 16px 20px 14px; display: flex; align-items: flex-start; gap: 14px; background: var(--accent-dim); }
.aphrc-detail-repo-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--accent-dim); border: 0.5px solid var(--accent-border);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.aphrc-detail-hero-body { flex: 1; min-width: 0; }
.aphrc-detail-title { font-size: 16px; font-weight: 600; letter-spacing: -.3px; margin-bottom: 3px; }
.aphrc-detail-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 10px; }
.aphrc-detail-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.aphrc-chip {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.aphrc-chip-lang { background: var(--bg-secondary); color: var(--text-secondary); border: 0.5px solid var(--border-secondary); }
.aphrc-chip-stat { background: var(--bg-secondary); color: var(--text-secondary); border: 0.5px solid var(--border-tertiary); }
.aphrc-chip-star { background: #FAEEDA; color: #854F0B; border: 0.5px solid rgba(186,117,23,.2); }

.aphrc-detail-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding-top: 2px; }
.aphrc-close-btn {
    width: 28px; height: 28px; border-radius: 50%;
    border: 0.5px solid var(--border-secondary); background: transparent;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--text-secondary); transition: background .15s, color .15s;
}
.aphrc-close-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.aphrc-gh-link {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; border: 0.5px solid var(--border-secondary);
    border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
    cursor: pointer; background: var(--bg-primary); color: var(--text-primary);
    transition: background .15s, border-color .15s; font-family: var(--sans);
    text-decoration: none;
}
.aphrc-gh-link:hover { background: var(--bg-secondary); border-color: var(--border-primary); }

.aphrc-detail-tags-row { padding: 0 20px 14px; display: flex; flex-wrap: wrap; gap: 4px; }
.aphrc-detail-tag {
    font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px;
    background: var(--accent-light); color: var(--accent-dark); border: 0.5px solid transparent;
}

/* Tabs */
.aphrc-detail-tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 0.5px solid var(--border-tertiary); }
.aphrc-tab {
    padding: 10px 14px; font-size: 12px; font-weight: 500; cursor: pointer;
    color: var(--text-secondary); border-bottom: 2px solid transparent;
    margin-bottom: -0.5px; transition: color .15s; white-space: nowrap;
}
.aphrc-tab:hover { color: var(--text-primary); }
.aphrc-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.aphrc-detail-body { padding: 20px; overflow-y: auto; flex: 1; max-height: calc(100vh - 280px); }
.aphrc-detail-body::-webkit-scrollbar { width: 3px; }
.aphrc-detail-body::-webkit-scrollbar-thumb { background: var(--border-secondary); border-radius: 4px; }

/* README */
.aphrc-readme { font-size: 13px; line-height: 1.75; color: var(--text-primary); }
.aphrc-readme h1 { font-size: 17px; font-weight: 600; letter-spacing: -.3px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 0.5px solid var(--border-tertiary); }
.aphrc-readme h2 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; color: var(--text-secondary); }
.aphrc-readme h3 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.aphrc-readme p { margin-bottom: 9px; color: var(--text-secondary); }
.aphrc-readme code { font-family: var(--mono); font-size: 11px; background: var(--bg-tertiary); padding: 1px 5px; border-radius: 4px; border: 0.5px solid var(--border-tertiary); }
.aphrc-readme pre { background: var(--bg-secondary); border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 11.5px; font-family: var(--mono); overflow-x: auto; margin: 10px 0; line-height: 1.65; }
.aphrc-readme pre code { background: none; border: none; padding: 0; }
.aphrc-readme ul, .aphrc-readme ol { margin: 6px 0 10px 1.1rem; color: var(--text-secondary); }
.aphrc-readme ul li, .aphrc-readme ol li { margin-bottom: 4px; }
.aphrc-readme img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.aphrc-readme a { color: var(--accent); text-decoration: none; }
.aphrc-readme a:hover { text-decoration: underline; }

/* Contributors */
.aphrc-contrib-list { display: flex; flex-direction: column; gap: 6px; }
.aphrc-contrib-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; background: var(--bg-secondary);
    border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-sm);
    transition: border-color .15s;
}
.aphrc-contrib-item:hover { border-color: var(--border-secondary); }
.aphrc-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
}
.aphrc-avatar--initials {
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; font-family: var(--sans);
}
.aphrc-contrib-name { font-size: 13px; font-weight: 600; letter-spacing: -.1px; }
.aphrc-contrib-name a { color: inherit; text-decoration: none; }
.aphrc-contrib-name a:hover { color: var(--accent); }
.aphrc-commit-badge {
    margin-left: auto; font-size: 11px; font-family: var(--mono);
    background: var(--bg-primary); border: 0.5px solid var(--border-tertiary);
    padding: 3px 9px; border-radius: 20px; color: var(--text-secondary); white-space: nowrap;
}

/* Releases */
.aphrc-releases { display: flex; flex-direction: column; gap: 8px; }
.aphrc-release {
    padding: 12px 14px; background: var(--bg-secondary);
    border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-sm);
    transition: border-color .15s;
}
.aphrc-release:hover { border-color: var(--border-secondary); }
.aphrc-release-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.aphrc-rel-tag {
    font-family: var(--mono); font-size: 11px; font-weight: 500;
    color: var(--accent-dark); background: var(--accent-light);
    padding: 3px 9px; border-radius: 20px; border: 0.5px solid var(--accent-border);
}
.aphrc-rel-name { font-size: 13px; font-weight: 600; letter-spacing: -.1px; }
.aphrc-rel-latest {
    font-size: 10px; font-weight: 600; background: var(--accent); color: #fff;
    padding: 2px 7px; border-radius: 20px; letter-spacing: .3px; text-transform: uppercase;
}
.aphrc-rel-date { font-size: 11px; color: var(--text-secondary); margin-bottom: 5px; font-family: var(--mono); }
.aphrc-rel-notes { font-size: 12px; color: var(--text-secondary); line-height: 1.55; }

/* Loading & empty */
.aphrc-loading { padding: 2rem; text-align: center; font-size: 13px; color: var(--text-secondary); }
.aphrc-empty { padding: 2rem; text-align: center; font-size: 13px; color: var(--text-secondary); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .aphrc-repos-wrapper .aphrc-toolbar {
        flex-wrap: wrap; gap: 8px;
    }
    .aphrc-repos-wrapper .aphrc-search-wrap { flex: 1 1 100%; }
    .aphrc-repos-wrapper .aphrc-filter-group { flex: 1 1 auto; }
    .aphrc-repos-wrapper .aphrc-filter-select { width: 100% !important; }
}
@media (max-width: 768px) {
    .aphrc-workspace { flex-direction: column; }
    .aphrc-list-col.sticky { flex: 1; position: static; max-height: none; }
    .aphrc-detail-col { flex: 1 !important; }
    .aphrc-org-header { flex-wrap: wrap; }
    .aphrc-repos-wrapper .aphrc-search-shortcut { display: none; }
}
