/* Token Inspector Styles
 * Design token audit tool for debug mode
 * Toggle with Alt+Shift+T
 */

/* ========== Floating trigger button ========== */
#dti-trigger {
    position: fixed;
    top: 24px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #25252e;
    border: 1px solid #3c3d47;
    color: #9C9FAD;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 99998;
    transition: all 0.2s;
    line-height: 1;
}

#dti-trigger:hover {
    background: #3c3d47;
    color: #3EB4FB;
    box-shadow: 0 0 12px rgba(62, 180, 251, 0.3);
}

#dti-trigger.active {
    background: #3EB4FB;
    color: #fff;
    border-color: #3EB4FB;
}

/* ========== Panel ========== */
#dti-panel {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 360px;
    max-height: calc(100vh - 24px);
    background: #1a1b22;
    color: #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 99999;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    overflow: hidden;
    display: none;
    flex-direction: column;
}

#dti-panel.open {
    display: flex;
}

#dti-panel.collapsed #dti-tabs,
#dti-panel.collapsed #dti-body {
    display: none;
}

#dti-panel.collapsed {
    width: auto;
}

/* ========== Header ========== */
#dti-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    background: #25252e;
    border-bottom: 1px solid #3c3d47;
    user-select: none;
}

#dti-header h3 {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

#dti-viewport {
    padding: 1px 5px;
    background: #3c3d47;
    border-radius: 3px;
    font-size: 10px;
    color: #9C9FAD;
    font-weight: 400;
    margin-left: 4px;
}

#dti-header h3 .icon {
    font-size: 13px;
}

#dti-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ========== Tabs ========== */
#dti-tabs {
    display: flex;
    border-bottom: 1px solid #3c3d47;
    background: #222;
}

.dti-tab {
    flex: 1;
    padding: 4px 4px;
    text-align: center;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #9C9FAD;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.15s;
    font-family: inherit;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.dti-tab:hover {
    color: #e0e0e0;
    background: #2a2b33;
}

.dti-tab.active {
    color: #3EB4FB;
    border-bottom-color: #3EB4FB;
}

/* ========== Body ========== */
#dti-body {
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    padding: 6px 8px;
}

/* Scrollbar */
#dti-body::-webkit-scrollbar {
    width: 6px;
}

#dti-body::-webkit-scrollbar-track {
    background: transparent;
}

#dti-body::-webkit-scrollbar-thumb {
    background: #3c3d47;
    border-radius: 3px;
}

/* ========== Stats ========== */
.dti-stats {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
}

.dti-stat {
    background: #2a2b33;
    border-radius: 3px;
    padding: 2px 4px;
    display: flex;
    align-items: baseline;
    gap: 3px;
    flex: 1;
    justify-content: center;
}

.dti-stat-value {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.dti-stat-label {
    font-size: 8px;
    color: #9C9FAD;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dti-stat.good .dti-stat-value { color: #5AD251; }
.dti-stat.bad .dti-stat-value { color: #FE5449; }
.dti-stat.info .dti-stat-value { color: #3EB4FB; }
.dti-stat.warn .dti-stat-value { color: #FFA312; }

/* ========== Gauge ========== */
.dti-gauge {
    background: #2a2b33;
    border-radius: 3px;
    padding: 3px 5px;
    margin-bottom: 4px;
}

.dti-gauge-bar {
    height: 4px;
    border-radius: 2px;
    background: #3c3d47;
    overflow: hidden;
    margin-top: 3px;
}

.dti-gauge-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.dti-gauge-label {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
}

/* ========== Section label ========== */
.dti-section-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #747680;
    margin: 4px 0 2px;
}

/* ========== Findings list ========== */
.dti-findings {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.dti-finding {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 5px;
    background: #2a2b33;
    border-radius: 3px;
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: background 0.1s;
}

.dti-finding:hover {
    background: #333;
}

.dti-finding.token {
    border-left-color: #5AD251;
}

.dti-finding.arbitrary {
    border-left-color: #FE5449;
}

.dti-finding.override {
    border-left-color: #FFA312;
}

.dti-finding-icon {
    font-size: 10px;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
}

.dti-finding-text {
    flex: 1;
    min-width: 0;
}

.dti-finding-class {
    color: #CE92F8;
    font-weight: 500;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.dti-finding-value {
    color: #9C9FAD;
    font-size: 9px;
    line-height: 1.2;
}

.dti-finding-suggest {
    color: #5AD251;
    font-size: 9px;
    line-height: 1.2;
}

.dti-finding-count {
    background: #3c3d47;
    color: #9C9FAD;
    font-size: 9px;
    padding: 0px 5px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ========== Toggle rows ========== */
.dti-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 8px;
    background: #2a2b33;
    border-radius: 4px;
    margin-bottom: 2px;
    cursor: pointer;
}

.dti-toggle-row:hover {
    background: #333;
}

.dti-toggle-label {
    font-size: 10px;
}

.dti-toggle {
    width: 28px;
    height: 16px;
    border-radius: 8px;
    background: #3c3d47;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.dti-toggle.on {
    background: #3EB4FB;
}

.dti-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.dti-toggle.on::after {
    transform: translateX(12px);
}

/* ========== Segmented control ========== */
.dti-segmented {
    display: flex;
    background: #1e1f26;
    border-radius: 4px;
    padding: 2px;
    margin-bottom: 4px;
    gap: 2px;
}

.dti-seg-btn {
    flex: 1;
    padding: 3px 0;
    font-size: 9px;
    font-weight: 500;
    color: #888;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    line-height: 1;
}

.dti-seg-btn:hover {
    color: #bbb;
}

.dti-seg-btn.active {
    background: #3c3d47;
    color: #fff;
}

/* ========== Element highlights ========== */
/* Outlines rendered via JS box-shadow stacking (updateHighlightOutlines).
   Classes kept for selection and cleanup. */
.dti-highlight-arbitrary,
.dti-highlight-radius,
.dti-highlight-spacing,
.dti-highlight-maxwidth {
    /* box-shadow set inline by JS — supports multiple concurrent layers */
}

/* ========== Max-width overlay ========== */
.dti-maxwidth-overlay {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    z-index: 99998;
    pointer-events: none;
    padding: 0 2px;
}

.dti-maxwidth-arrow {
    color: #EAB308;
    font-size: 8px;
    line-height: 1;
    flex-shrink: 0;
}

.dti-maxwidth-line {
    flex: 1;
    height: 1px;
    background: #EAB308;
    min-width: 4px;
}

.dti-maxwidth-label {
    padding: 0 2px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 2px;
    line-height: 1.1;
    flex-shrink: 0;
    background: rgba(234, 179, 8, 0.9);
    color: #1a1b22;
}

.dti-maxwidth-label.good {
    background: rgba(90, 210, 81, 0.9);
    color: #fff;
}

.dti-maxwidth-label.bad {
    background: rgba(254, 84, 73, 0.9);
    color: #fff;
}

/* ========== Hover tooltip ========== */
#dti-tooltip {
    position: fixed;
    z-index: 999999;
    background: #1a1b22;
    color: #e0e0e0;
    border-radius: 5px;
    padding: 4px 8px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 10px;
    max-width: 400px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    display: none;
    border: 1px solid #3c3d47;
}

#dti-tooltip .row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 1px 0;
    line-height: 1.5;
}

#dti-tooltip .prop {
    color: #9C9FAD;
    min-width: 58px;
}

#dti-tooltip .val {
    color: #fff;
}

#dti-tooltip .val.bad {
    color: #FE5449;
}

#dti-tooltip .divider {
    border-top: 1px solid #3c3d47;
    margin: 2px 0;
}

#dti-tooltip .tag {
    display: inline-block;
    font-size: 8px;
    padding: 0px 3px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

#dti-tooltip .tag.token {
    background: rgba(90, 210, 81, 0.15);
    color: #5AD251;
}

#dti-tooltip .tag.arbitrary {
    background: rgba(254, 84, 73, 0.15);
    color: #FE5449;
}

#dti-tooltip .tag.suggest {
    background: rgba(62, 180, 251, 0.15);
    color: #3EB4FB;
}

#dti-tooltip .tag.inherited {
    background: rgba(156, 159, 173, 0.15);
    color: #9C9FAD;
    border: 1px dashed rgba(156, 159, 173, 0.4);
}

/* ========== Radius labels ========== */
.dti-radius-label {
    position: absolute;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 9px;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
    line-height: 1.1;
    z-index: 99998;
    pointer-events: none;
    white-space: nowrap;
}

.dti-radius-label.good {
    background: rgba(90, 210, 81, 0.9);
    color: #fff;
}

.dti-radius-label.bad {
    background: rgba(254, 84, 73, 0.9);
    color: #fff;
}

.dti-radius-label.info {
    background: rgba(62, 180, 251, 0.9);
    color: #fff;
}

/* Margin label (amber) */
.dti-radius-label.margin {
    background: rgba(245, 158, 11, 0.9);
    color: #fff;
}

/* Gap label */
.dti-radius-label.gap {
    background: rgba(25, 176, 196, 0.9);
    color: #fff;
}

/* Gap overlay fill */
.dti-gap-overlay {
    background: rgba(108, 238, 223, 0.15);
    border: 1px dashed rgba(108, 238, 223, 0.5);
}

/* ========== Buttons ========== */
.dti-btn {
    background: none;
    border: none;
    color: #9C9FAD;
    cursor: pointer;
    font-size: 14px;
    padding: 1px 4px;
    border-radius: 4px;
    transition: all 0.1s;
    line-height: 1;
}

.dti-btn:hover {
    color: #fff;
    background: #3c3d47;
}

/* ========== Clean message ========== */
.dti-clean-message {
    color: #5AD251;
    padding: 8px;
    text-align: center;
}

/* ========== Pinned element outline (solid, double thick) ========== */
.dti-pinned-active {
    outline: 4px solid rgba(62, 180, 251, 0.9) !important;
    outline-offset: -4px;
    position: relative;
    z-index: 51; /* above fixed header (z-50) */
}

/* ========== Hover highlight (dashed blue) ========== */
.dti-hover-active {
    outline: 2px dashed rgba(62, 180, 251, 0.8) !important;
    outline-offset: 2px;
}

/* Hover label (element name above hovered element) */
.dti-hover-label {
    position: absolute;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(62, 180, 251, 0.85);
    color: #fff;
    z-index: 99998;
    pointer-events: none;
    white-space: nowrap;
}

/* ========== Pinned tooltip (interactive) ========== */
#dti-pinned {
    position: fixed;
    z-index: 999999;
    background: rgba(26, 27, 34, 0.88);
    backdrop-filter: blur(12px);
    color: #e0e0e0;
    border-radius: 6px;
    padding: 5px 8px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 10px;
    min-width: 240px;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid #3EB4FB;
    pointer-events: auto;
    transition: background 0.15s, backdrop-filter 0.15s;
}

/* Close button */
.dti-pinned-close {
    position: absolute;
    top: 3px;
    right: 4px;
    background: none;
    border: none;
    color: #9C9FAD;
    font-size: 13px;
    cursor: pointer;
    padding: 0px 3px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.1s;
}

.dti-pinned-close:hover {
    color: #fff;
    background: #3c3d47;
}

/* Rows */
.dti-pinned-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 1px 0;
    line-height: 1.5;
    flex-wrap: wrap;
}

.dti-pinned-row .prop {
    color: #9C9FAD;
    min-width: 58px;
    flex-shrink: 0;
}

.dti-pinned-row .val {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 3px;
}

.dti-pinned-row .val.bad {
    color: #FE5449;
}

.dti-pinned-el-tag {
    padding-right: 18px;
    cursor: grab;
}

#dti-pinned.dti-dragging {
    user-select: none;
    background: rgba(26, 27, 34, 0.6);
    backdrop-filter: blur(8px);
}

#dti-pinned.dti-dragging .dti-pinned-el-tag {
    cursor: grabbing;
}

.dti-pinned-el-tag .prop {
    font-weight: 700;
    color: #7ec8f0;
}

.dti-el-text {
    opacity: 0.55;
    font-style: italic;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Divider */
.dti-pinned-divider {
    border-top: 1px solid #3c3d47;
    margin: 2px 0;
}

/* Tags in pinned tooltip */
#dti-pinned .tag {
    display: inline-block;
    font-size: 8px;
    padding: 0px 3px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

#dti-pinned .tag.token {
    background: rgba(90, 210, 81, 0.15);
    color: #5AD251;
}

#dti-pinned .tag.arbitrary {
    background: rgba(254, 84, 73, 0.15);
    color: #FE5449;
}

#dti-pinned .tag.suggest {
    background: rgba(62, 180, 251, 0.15);
    color: #3EB4FB;
}

#dti-pinned .tag.inherited {
    background: rgba(156, 159, 173, 0.15);
    color: #9C9FAD;
    border: 1px dashed rgba(156, 159, 173, 0.4);
}

/* Interactive row (with switcher) */
.dti-pinned-interactive {
    background: #2a2b33;
    border-radius: 3px;
    padding: 2px 5px;
    margin: 0px 0;
}

/* Clickable tags (click to reveal switcher) */
.dti-tag-clickable {
    cursor: pointer;
    transition: all 0.15s;
}

.dti-tag-clickable:hover {
    text-decoration: underline;
    filter: brightness(1.2);
}

/* Token switcher dropdown */
.dti-pinned-switcher {
    background: #3c3d47;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 2px 4px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    max-width: 260px;
    outline: none;
    transition: border-color 0.15s;
}

.dti-pinned-switcher:hover {
    border-color: #3EB4FB;
}

.dti-pinned-switcher:focus {
    border-color: #3EB4FB;
    box-shadow: 0 0 0 1px rgba(62, 180, 251, 0.3);
}

/* Copy button */
.dti-pinned-copy {
    background: none;
    border: 1px solid transparent;
    color: #9C9FAD;
    cursor: pointer;
    padding: 0px 3px;
    border-radius: 3px;
    font-size: 11px;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dti-pinned-copy:hover {
    color: #fff;
    background: #3c3d47;
    border-color: #555;
}

.dti-pinned-copy.copied {
    color: #5AD251;
    background: rgba(90, 210, 81, 0.15);
    border-color: #5AD251;
}

/* Copied badge (Cmd+C feedback) */
.dti-copied-badge {
    position: fixed;
    z-index: 10000000;
    background: #5AD251;
    color: #1a1b22;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease 0.6s;
}

.dti-copied-badge.fade {
    opacity: 0;
}

/* Color swatch */
.dti-color-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}
