/**
 * WebCraft Component Inspector V2
 * Dark theme, collapsible panel, tree view, design controls
 */

/* =====================================================
   INSPECTOR PANEL - Main Container
   ===================================================== */
#wcInspectorPanel {
    position: relative;
    width: 320px;
    min-width: 280px;
    max-width: 400px;
    height: 100%;
    background: #0d1117;
    border-left: 1px solid rgba(0, 240, 255, 0.15);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 12px;
    color: #c9d1d9;
    transition: width 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
}

#wcInspectorPanel.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
    opacity: 0;
    pointer-events: none;
}

/* =====================================================
   PANEL HEADER
   ===================================================== */
.wc-inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    flex-shrink: 0;
}

.wc-inspector-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #e6edf3;
}

.wc-inspector-title i {
    color: #00f0ff;
    font-size: 14px;
}

.wc-inspector-close {
    background: transparent;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}

.wc-inspector-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e6edf3;
}

/* =====================================================
   TABS - Components / Design / CSS
   ===================================================== */
.wc-inspector-tabs {
    display: flex;
    background: #161b22;
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    flex-shrink: 0;
}

.wc-inspector-tab {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.wc-inspector-tab:hover {
    color: #c9d1d9;
    background: rgba(255, 255, 255, 0.03);
}

.wc-inspector-tab.active {
    color: #00f0ff;
    border-bottom-color: #00f0ff;
    background: rgba(0, 240, 255, 0.05);
}

.wc-inspector-tab i {
    font-size: 12px;
}

/* =====================================================
   TAB CONTENT AREA
   ===================================================== */
.wc-inspector-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wc-tab-panel {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.wc-tab-panel.active {
    display: flex;
}

/* =====================================================
   COMPONENTS TAB - Tree View
   ===================================================== */
.wc-tree-search {
    padding: 8px 10px;
    background: #161b22;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.wc-tree-search input {
    width: 100%;
    padding: 7px 10px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e6edf3;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s;
}

.wc-tree-search input:focus {
    border-color: rgba(0, 240, 255, 0.5);
}

.wc-tree-search input::placeholder {
    color: #6e7681;
}

.wc-tree-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
}

/* Tree Node */
.wc-tree-node {
    user-select: none;
}

.wc-tree-node-content {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.1s;
    border-left: 2px solid transparent;
}

.wc-tree-node-content:hover {
    background: rgba(255, 255, 255, 0.04);
}

.wc-tree-node-content.selected {
    background: rgba(0, 240, 255, 0.1);
    border-left-color: #00f0ff;
}

.wc-tree-node-content.hover-highlight {
    background: rgba(0, 240, 255, 0.06);
}

.wc-tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6e7681;
    font-size: 8px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.wc-tree-toggle.expanded {
    transform: rotate(90deg);
}

.wc-tree-toggle.empty {
    visibility: hidden;
}

.wc-tree-tag {
    color: #ff7b72;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin-right: 4px;
}

.wc-tree-id {
    color: #ffa657;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    margin-right: 3px;
}

.wc-tree-class {
    color: #a5d6ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wc-tree-text {
    color: #6e7681;
    font-size: 10px;
    margin-left: 6px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}

.wc-tree-children {
    padding-left: 14px;
    display: none;
}

.wc-tree-node.expanded > .wc-tree-children {
    display: block;
}

/* Search highlight */
.wc-tree-highlight {
    background: rgba(255, 183, 77, 0.3);
    border-radius: 2px;
}

/* =====================================================
   DESIGN TAB - Controls
   ===================================================== */
.wc-design-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* No Selection State */
.wc-no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6e7681;
}

.wc-no-selection i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.wc-no-selection p {
    font-size: 12px;
    line-height: 1.5;
}

.wc-no-selection .hint {
    margin-top: 8px;
    font-size: 11px;
    color: #00f0ff;
    opacity: 0.7;
}

/* Accordion Section */
.wc-accordion {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wc-accordion:last-child {
    border-bottom: none;
}

.wc-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #e6edf3;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}

.wc-accordion-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.wc-accordion-header i {
    color: #6e7681;
    font-size: 10px;
    transition: transform 0.15s;
}

.wc-accordion.open .wc-accordion-header i {
    transform: rotate(180deg);
}

.wc-accordion-content {
    display: none;
    padding: 8px 12px 12px;
}

.wc-accordion.open .wc-accordion-content {
    display: block;
}

/* Control Row */
.wc-control-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.wc-control-row:last-child {
    margin-bottom: 0;
}

.wc-control-label {
    width: 80px;
    flex-shrink: 0;
    font-size: 11px;
    color: #8b949e;
}

.wc-control-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Text Input */
.wc-input {
    width: 100%;
    padding: 6px 8px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #e6edf3;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.15s;
}

.wc-input:focus {
    border-color: rgba(0, 240, 255, 0.5);
}

.wc-input::placeholder {
    color: #484f58;
}

/* Select */
.wc-select {
    width: 100%;
    padding: 6px 8px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #e6edf3;
    font-size: 11px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.wc-select:focus {
    border-color: rgba(0, 240, 255, 0.5);
}

/* Color Input */
.wc-color-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.wc-color-picker {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    background: #0d1117;
}

.wc-color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.wc-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.wc-color-text {
    flex: 1;
    padding: 6px 8px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #e6edf3;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

/* Spacing Grid (4 sides) */
.wc-spacing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.wc-spacing-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wc-spacing-input label {
    font-size: 9px;
    color: #6e7681;
    width: 14px;
    text-transform: uppercase;
}

.wc-spacing-input input {
    flex: 1;
    min-width: 0;
}

/* Reset Button */
.wc-reset-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px;
    color: #ff6b6b;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 8px;
}

.wc-reset-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.5);
}

/* Flex Controls */
.wc-flex-controls {
    display: none;
}

.wc-flex-controls.visible {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* =====================================================
   CSS TAB - Raw CSS Editor
   ===================================================== */
.wc-css-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px;
}

.wc-css-selector {
    margin-bottom: 10px;
}

.wc-css-selector-label {
    font-size: 10px;
    color: #6e7681;
    margin-bottom: 4px;
}

.wc-css-selector-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #a5d6ff;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.wc-css-textarea {
    flex: 1;
    min-height: 150px;
    padding: 10px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e6edf3;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
}

.wc-css-textarea:focus {
    border-color: rgba(0, 240, 255, 0.5);
}

.wc-css-textarea::placeholder {
    color: #484f58;
}

.wc-css-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.wc-css-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.wc-css-btn-apply {
    background: linear-gradient(135deg, #00f0ff, #00c8d4);
    border: none;
    color: #0d1117;
}

.wc-css-btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.3);
}

.wc-css-btn-clear {
    background: transparent;
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #ff6b6b;
}

.wc-css-btn-clear:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* =====================================================
   TOGGLE BUTTON (in browser-actions)
   ===================================================== */
#toggleComponentsPanel {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 5px 10px !important;
    border-radius: 6px !important;
    font-weight: 600;
    font-size: 11px;
    transition: all 0.2s ease !important;
    white-space: nowrap;
    height: auto !important;
    width: auto !important;
    background: rgba(100, 116, 139, 0.15) !important;
    border: 1px solid rgba(100, 116, 139, 0.3) !important;
    color: #94a3b8 !important;
}

#toggleComponentsPanel:hover {
    background: rgba(100, 116, 139, 0.25) !important;
    color: #cbd5e1 !important;
}

#toggleComponentsPanel.active {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    border: 1px solid #8b5cf6 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

#toggleComponentsPanel.active:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.5);
}

#toggleComponentsPanel i {
    font-size: 12px;
}

/* =====================================================
   PREVIEW WRAPPER (for side-by-side layout)
   ===================================================== */
.wc-preview-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.wc-preview-wrapper > iframe {
    flex: 1;
    min-width: 0;
}

/* =====================================================
   SCROLLBAR STYLING
   ===================================================== */
#wcInspectorPanel ::-webkit-scrollbar {
    width: 6px;
}

#wcInspectorPanel ::-webkit-scrollbar-track {
    background: transparent;
}

#wcInspectorPanel ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

#wcInspectorPanel ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) {
    #wcInspectorPanel {
        width: 280px;
        min-width: 240px;
    }
}

/* =====================================================
   ELEMENT INFO BAR (in Design/CSS tabs)
   ===================================================== */
.wc-element-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 240, 255, 0.05);
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
    flex-shrink: 0;
}

.wc-element-info-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #ff7b72;
    font-weight: 600;
}

.wc-element-info-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #ffa657;
}

.wc-element-info-class {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #a5d6ff;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

