/* GitHub Auth Modal */
.gh-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(8px);
    z-index: 600;
    display: none;
    align-items: center;
    justify-content: center;
}
.gh-modal-backdrop.show { display: flex; }

.gh-modal {
    background: var(--glass-bg-solid);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 32px;
    width: 600px;
    max-width: 90vw;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.gh-modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}
.gh-modal .gh-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}
.gh-modal label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gh-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    outline: none;
    margin-bottom: 15px;
    transition: border-color 0.15s;
}
.gh-input:focus { border-color: var(--accent); }
.gh-input::placeholder { color: var(--text-muted); }
select.gh-input option { background: #1a1a2e; color: var(--text); }

.gh-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
.gh-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.gh-btn:hover { background: rgba(255,255,255,0.12); }
.gh-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}
.gh-btn-primary:hover { background: #5558e6; }
.gh-btn-danger {
    color: #f87171;
    border-color: rgba(248,113,113,0.3);
}
.gh-btn-danger:hover { background: rgba(248,113,113,0.12); }

.gh-error {
    color: #f87171;
    font-size: 12px;
    margin-top: 8px;
    display: none;
}
.gh-error.show { display: block; }

.gh-scopes {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}
.gh-scopes code {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
}

/* GitHub Repo Browser */
.gh-browser {
    position: absolute;
    left: 16px;
    top: 16px;
    bottom: 16px;
    width: 340px;
    z-index: 15;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.4s ease;
}
.gh-browser.show { display: flex; }
.gh-browser.collapsed { transform: translateX(calc(-100% - 20px)); opacity: 0; pointer-events: none; }

.gh-browser-header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.gh-browser-header .gh-path {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.gh-crumb {
    color: var(--accent);
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
}
.gh-crumb:hover { text-decoration: underline; }
.gh-crumb-sep { color: var(--text-muted); font-size: 12px; }

.gh-search-box {
    padding: 5px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    width: 100%;
}
.gh-search-box:focus { border-color: var(--accent); }
.gh-search-box::placeholder { color: var(--text-muted); }
.gh-browser-branch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.gh-browser-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
}
.gh-browser-body::-webkit-scrollbar { width: 6px; }
.gh-browser-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.gh-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid transparent;
}
.gh-list-item:hover { background: rgba(255,255,255,0.05); }
.gh-list-item.disabled { opacity: 0.35; cursor: default; }
.gh-list-item.disabled:hover { background: transparent; }

.gh-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.gh-item-icon.repo { background: rgba(99,102,241,0.2); }
.gh-item-icon.folder { background: rgba(251,191,36,0.15); }
.gh-item-icon.file-3d { background: rgba(52,211,153,0.2); }
.gh-item-icon.file-other { background: rgba(255,255,255,0.06); }
.gh-lfs-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.gh-lfs-badge.lfs { background: rgba(99,102,241,0.2); color: #818cf8; }
.gh-lfs-badge.locked { background: rgba(239,68,68,0.2); color: #f87171; }

.gh-item-info { flex: 1; min-width: 0; }
.gh-item-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gh-item-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.gh-item-meta {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.gh-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
    font-size: 14px;
    gap: 10px;
}
.gh-loading .spinner { width: 18px; height: 18px; border-width: 2px; }

.gh-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Connected indicator — styles moved to css/avatar.css (shared with home page).
   Old .gh-connected .gh-avatar-ring + .gh-avatar rules retired in favor of
   .gh-connected + .gh-avatar-ring-sm used by both pages. */

/* Org filter tabs in browser header */
.gh-owner-tabs {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 4px;
}
.gh-owner-tab {
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.gh-owner-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.05); }
.gh-owner-tab.active {
    color: var(--text);
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.3);
}

/* Branch selector dropdown */
.gh-branch-select {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    padding: 3px 6px;
    cursor: pointer;
    outline: none;
    max-width: 140px;
}
.gh-branch-select:focus { border-color: var(--accent); }
.gh-branch-select option { background: #1a1a2e; color: var(--text); }
.branch-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: auto;
    margin-left: 6px;
}

/* Commit history */
.gh-commits { padding: 0 16px 12px; }
.gh-commit-item {
    display: flex;
    gap: 10px;
    padding: 8px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.gh-commit-item:last-child { border-bottom: none; }
.gh-commit-item:hover { background: rgba(255,255,255,0.05); }
.gh-commit-item.active { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.25); }
.gh-commit-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    margin-top: 4px;
}
.gh-commit-item.active .gh-commit-dot { background: var(--accent); }
.gh-commit-info { flex: 1; min-width: 0; }
.gh-commit-msg {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gh-commit-item.active .gh-commit-msg { color: var(--text); }
.gh-commit-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}
.gh-commit-sha {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    cursor: pointer;
    font-size: 11px;
}
.gh-commit-sha:hover { text-decoration: underline; }
.gh-commit-view {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    align-self: center;
    white-space: nowrap;
}
.gh-commit-item.active .gh-commit-view { color: var(--accent); }
.gh-commit-item:hover .gh-commit-view { color: var(--text-secondary); }

/* Open on GitHub footer button */
.gh-browser-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 8px 12px;
    flex-shrink: 0;
}
.gh-open-github-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}
.gh-open-github-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}

/* Refresh button in GitHub panel header */
.gh-refresh-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    line-height: 1;
    margin-left: auto;
    transition: color 0.15s, transform 0.3s;
    border-radius: 4px;
}
.gh-refresh-btn:hover { color: var(--text); transform: rotate(180deg); }

.gh-expand-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 2px 2px 0;
    line-height: 1;
    transition: color 0.15s, transform 0.4s ease;
    border-radius: 4px;
}
.gh-expand-btn:hover { color: var(--text); }
.gh-expand-btn.expanded { transform: rotate(180deg); }

.gh-grid-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 2px 2px 0;
    line-height: 1;
    transition: color 0.15s;
    border-radius: 4px;
}
.gh-grid-btn:hover { color: var(--text); }
.gh-grid-btn.active { color: var(--accent); }

/* ---- Grid / Card View ---- */
.gh-browser-body.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: min-content;
    gap: 10px;
    padding: 10px;
    align-content: start;
    overflow-y: auto;
}

.gh-browser-body.grid-view .gh-list-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    background: rgba(255,255,255,0.02);
    min-height: 0;
}
.gh-browser-body.grid-view .gh-list-item:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}

.gh-browser-body.grid-view .gh-repo-thumb {
    display: flex;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 0;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    position: relative;
    overflow: hidden;
    flex-shrink: 1;
}
.gh-browser-body.grid-view .gh-repo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gh-browser-body.grid-view .gh-repo-thumb .gh-thumb-fallback {
    font-size: 36px;
    opacity: 0.4;
}
.gh-browser-body.grid-view .gh-repo-thumb .gh-item-icon {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    font-size: 11px;
    border-radius: 5px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.gh-browser-body.grid-view .gh-item-info {
    padding: 8px 10px;
    flex-shrink: 0;
}
.gh-browser-body.grid-view .gh-item-name {
    font-size: 12px;
}
.gh-browser-body.grid-view .gh-item-desc {
    font-size: 10px;
}
.gh-browser-body.grid-view .gh-item-meta {
    display: none;
}

/* Hide thumbnail in list view */
.gh-repo-thumb { display: none; }
/* Hide inline icon in grid view (thumbnail has its own) */
.gh-browser-body.grid-view > .gh-list-item > .gh-item-icon { display: none; }


/* ============================================================
   Export Modal: format-tag buttons (replaces the old <select>)
   Visually identical to home.html's .format-tag-export. Active
   state matches the same hover state — selecting a format looks
   like hovering it, with a slight emphasis.
   ============================================================ */
.export-format-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 18px;
}

.format-tag-export {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}
.format-tag-export:hover {
    background: rgba(245, 158, 11, 0.2);   /* matches home.css */
    border-color: #f59e0b;
    color: white;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}
/* Selected state — exactly the hover look, kept after click. */
.format-tag-export.active {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: white;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}
/* When active AND hovered, give a tiny lift so the user gets feedback
   that re-clicking is a no-op but the button responded. */
.format-tag-export.active:hover {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.55);
}

/* ============================================================
   Export Modal: rotation row (slider + numeric input + buttons).
   Reuses .move-axis-btn / .move-field / .edge-slider that the
   move tool already defines.
   ============================================================ */
.export-rotation-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.export-rotation-row .move-field {
    width: 70px;            /* a bit wider — fits -180 cleanly */
}
.export-rotation-row .edge-slider {
    flex: 1;                /* slider takes the remaining space */
    min-width: 100px;
}
