/* Structure Viewer 2.2 – Tree Structure */

.sv-container {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
}

/* ── Plugin/Theme heading ───────────────────────────────────── */
.sv-plugin-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(124,58,237,0.08) 0%, rgba(30,41,59,0.4) 100%);
    border: 1px solid rgba(124,58,237,0.18);
    border-radius: var(--sv-radius);
    flex-wrap: wrap;
    gap: 10px;
}

/* Simple all-mode heading – less prominent */
.sv-plugin-heading-simple {
    background: rgba(30,41,59,0.3);
    border-color: var(--sv-border);
    padding: 10px 14px;
    margin-bottom: 10px;
}

/* Left side: icon + name + badge */
.sv-plugin-heading-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Icon bubble */
.sv-plugin-heading-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--sv-radius-sm);
    background: var(--sv-accent-dim);
    border: 1px solid rgba(124,58,237,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--sv-accent-text);
}

/* Smaller icon for all-mode rows */
.sv-plugin-heading-icon-sm {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    background: rgba(30,41,59,0.6);
    border-color: var(--sv-border-2);
    color: var(--sv-text-3);
    align-content: center;
    text-align: center;
}

.sv-plugin-heading-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.sv-plugin-heading-name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--sv-text);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: none;
    padding: 0;
}

/* Smaller name in all-mode — bold, full colour */
.sv-plugin-heading-name-sm {
    font-size: 14px;
    font-weight: 700;
    color: var(--sv-text);
    letter-spacing: -0.01em;
}

/* All-mode heading is clickable to drill into that item */
.sv-plugin-heading-simple {
    cursor: pointer;
    transition: background var(--sv-transition), border-color var(--sv-transition), transform var(--sv-transition);
}

.sv-plugin-heading-simple:hover {
    background: rgba(124,58,237,0.08);
    border-color: rgba(124,58,237,0.2);
}

/* "View structure →" hint that appears on hover */
.sv-plugin-heading-simple .sv-heading-drill {
    display: none;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--sv-accent-text);
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--sv-transition);
}
.sv-plugin-heading-simple:hover .sv-heading-drill {
    display: flex;
    opacity: 1;
}

/* Type badge pill */
.sv-plugin-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--sv-accent-dim);
    color: var(--sv-accent-text);
    border: 1px solid rgba(124,58,237,0.2);
    width: fit-content;
}

/* ── Controls row (Expand/Collapse/Copy + Export) ──────────── */
.sv-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.sv-button-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sv-toggle-group {
    margin-right: auto;
}

/* Secondary action buttons */
.sv-expand-all,
.sv-collapse-all,
.sv-copy-clipboard {
    height: 34px;
    line-height: 1 !important;
    padding: 0 14px !important;
    border: 1px solid var(--sv-border-2) !important;
    background: var(--sv-surface-3) !important;
    color: var(--sv-text-2) !important;
    border-radius: var(--sv-radius-sm) !important;
    font-size: 12.5px !important;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--sv-transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
    box-shadow: none !important;
    text-decoration: none;
}

.sv-expand-all:hover,
.sv-collapse-all:hover,
.sv-copy-clipboard:hover {
    background: var(--sv-surface-hover) !important;
    border-color: var(--sv-border-2) !important;
    color: var(--sv-text) !important;
}

.sv-expand-all:active,
.sv-collapse-all:active,
.sv-copy-clipboard:active {
    transform: translateY(1px);
}

/* Export wrapper */
.sv-export-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Export button – primary purple */
.button-primary.sv-export {
    height: 34px;
    line-height: 1 !important;
    padding: 0 18px !important;
    border: 1px solid var(--sv-accent) !important;
    background: var(--sv-accent) !important;
    color: #fff !important;
    border-radius: var(--sv-radius-sm) !important;
    font-size: 12.5px !important;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--sv-transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    box-shadow: 0 0 16px var(--sv-accent-glow) !important;
    text-shadow: none;
    text-decoration: none;
}

.button-primary.sv-export:hover {
    background: var(--sv-accent-hover) !important;
    border-color: var(--sv-accent-hover) !important;
    box-shadow: 0 0 24px var(--sv-accent-glow) !important;
    transform: translateY(-1px);
}

.button-primary.sv-export:active {
    transform: translateY(1px);
}

/* ── Tree list ─────────────────────────────────────────────── */
.sv-tree {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.sv-folder,
.sv-file {
    margin: 0 0 0 18px;
    padding: 1px 0;
    line-height: 1.8;
}

/* Folder header – icon stays amber, text is neutral */
.sv-folder-header {
    cursor: pointer;
    font-weight: 600;
    color: var(--sv-text-2);
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--sv-transition);
    gap: 4px;
}

.sv-folder-header:hover,
.sv-folder-header:focus {
    color: var(--sv-text);
    background: rgba(255,255,255,0.05);
    outline: none;
}

.sv-toggle {
    font-size: 12px;
    min-width: 14px;
    text-align: center;
    color: var(--sv-text-3);
    font-weight: 400;
    font-family: monospace;
}

/* File/folder icons – SVG inline backgrounds */
.sv-folder-icon,
.sv-file-icon {
    margin-right: 6px;
    width: 15px;
    height: 15px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Folder icon – amber */
.sv-folder-icon {
    background: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f59e0b'%3e%3cpath d='M10 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3e%3c/svg%3e") no-repeat center/15px;
}

/* Default file icon – neutral grey */
.sv-file-icon {
    background: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3e%3cpath d='M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z'/%3e%3c/svg%3e") no-repeat center/15px;
}

/* ── Light mode: plugin/theme headings ──────────────────────── */
.sv-app.sv-light-mode .sv-plugin-heading {
    background: #ffffff;
    border-color: #e2e8f0;
}
.sv-app.sv-light-mode .sv-plugin-heading-simple {
    background: #f8fafc;
    border-color: #e2e8f0;
}
.sv-app.sv-light-mode .sv-plugin-heading-simple:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.sv-app.sv-light-mode .sv-plugin-heading-icon {
    background: rgba(139,92,246,0.1);
    border-color: rgba(139,92,246,0.15);
}
.sv-app.sv-light-mode .sv-plugin-heading-icon-sm {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
}
.sv-app.sv-light-mode .sv-plugin-heading-name {
    color: #0f172a;
}
.sv-app.sv-light-mode .sv-plugin-heading-name-sm {
    color: #1e293b;
}
.sv-app.sv-light-mode .sv-plugin-type-badge {
    background: rgba(139,92,246,0.1);
    border-color: rgba(139,92,246,0.2);
    color: #7c3aed;
}
.sv-app.sv-light-mode .sv-folder-header {
    color: #334155;
}
.sv-app.sv-light-mode .sv-folder-header:hover {
    background: rgba(0,0,0,0.03);
    color: #0f172a;
}
.sv-app.sv-light-mode .sv-subtree,
.sv-app.sv-light-mode .sv-nested-subtree {
    border-left-color: #e2e8f0;
}
.sv-app.sv-light-mode .sv-file-info {
    color: #94a3b8;
}
.sv-nested-subtree {
    list-style: none;
    padding: 0;
    margin: 2px 0 2px 18px;
    border-left: 1px solid var(--sv-border-2);
}

/* File name links */
.sv-file-name {
    color: var(--sv-text-2);
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all var(--sv-transition);
    font-size: 13.5px;
}

.sv-file-name:hover,
.sv-file-name:focus {
    color: var(--sv-text);
    background: var(--sv-surface-3);
    text-decoration: none;
    outline: none;
}

.sv-file-info {
    font-size: 11.5px;
    color: var(--sv-text-3);
    margin-left: 8px;
    font-family: 'Courier New', monospace;
}

/* ── Image file links ──────────────────────────────────────── */
.sv-file-icon-image,
.sv-file-icon-jpg,
.sv-file-icon-jpeg,
.sv-file-icon-png,
.sv-file-icon-gif,
.sv-file-icon-svg,
.sv-file-icon-webp,
.sv-file-icon-bmp,
.sv-file-icon-ico {
    background: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239b51e0'%3e%3cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3e%3c/svg%3e") no-repeat center/15px !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sv-controls { flex-direction: column; align-items: flex-start; gap: 8px; }
    .sv-toggle-group { margin-right: 0; width: 100%; }
    .sv-export-wrapper { width: 100%; }
}

@media (max-width: 782px) {
    .sv-container { padding: 16px; }
    .sv-plugin-heading { flex-direction: column; align-items: flex-start; }
    .sv-button-group { flex-wrap: wrap; width: 100%; }
    .sv-folder, .sv-file { margin-left: 10px; }
    .sv-subtree, .sv-nested-subtree { margin-left: 10px; }
}

@media (max-width: 480px) {
    .sv-container { padding: 12px; }
    .sv-plugin-heading h1 { font-size: 15px; }
}