/* ===================================
   CSS DEBUG - Estilo Chrome DevTools
   =================================== */

/* Activar debug: añadir class="debug-mode" a <body> */
body.debug-mode * {
    outline: 1px solid rgba(0, 122, 255, 0.3) !important;
}

/* Panel principal estilo DevTools */
.debug-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 13px;
    z-index: 9999;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.debug-panel.open {
    transform: translateX(0);
}

/* Header estilo DevTools */
.debug-panel-header {
    background: #252526;
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.debug-panel-title {
    color: #cccccc;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.debug-panel-close {
    background: none;
    border: none;
    color: #cccccc;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.debug-panel-close:hover {
    background: #333;
}

/* Tabs estilo DevTools */
.debug-panel-tabs {
    background: #252526;
    border-bottom: 1px solid #333;
    display: flex;
    flex-shrink: 0;
}

.debug-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    color: #9e9e9e;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.debug-tab:hover {
    color: #cccccc;
    background: #2d2d2d;
}

.debug-tab.active {
    color: #007acc;
    border-bottom-color: #007acc;
    background: #1e1e1e;
}

/* Content area */
.debug-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.debug-section {
    display: none;
}

.debug-section.active {
    display: block;
}

/* Tree view estilo DevTools */
.debug-tree {
    font-family: inherit;
    font-size: 12px;
    line-height: 1.4;
}

.debug-tree-item {
    padding: 2px 0;
    cursor: pointer;
    user-select: none;
}

.debug-tree-item:hover {
    background: #2d2d2d;
}

.debug-tree-item.expanded > .debug-tree-children {
    display: block;
}

.debug-tree-children {
    display: none;
    margin-left: 16px;
}

.debug-tree-label {
    display: flex;
    align-items: center;
    padding: 2px 4px;
}

.debug-tree-arrow {
    width: 12px;
    height: 12px;
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 10px;
}

.debug-tree-arrow.expanded {
    transform: rotate(90deg);
}

.debug-tree-key {
    color: #9cdcfe;
    margin-right: 4px;
}

.debug-tree-value {
    color: #ce9178;
}

.debug-tree-string {
    color: #ce9178;
}

.debug-tree-number {
    color: #b5cea8;
}

.debug-tree-boolean {
    color: #569cd6;
}

/* Variables section */
.debug-variables-grid {
    display: grid;
    gap: 4px;
}

.debug-variable-item {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 2px;
    transition: background 0.2s;
}

.debug-variable-item:hover {
    background: #2d2d2d;
}

.debug-variable-name {
    color: #9cdcfe;
}

.debug-variable-value {
    color: #ce9178;
}

/* Colors section */
.debug-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.debug-color-item {
    background: #2d2d2d;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.debug-color-item:hover {
    border-color: #007acc;
    transform: translateY(-1px);
}

.debug-color-swatch {
    width: 100%;
    height: 40px;
    border-radius: 2px;
    margin-bottom: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-color-name {
    font-size: 11px;
    color: #cccccc;
    margin-bottom: 2px;
}

.debug-color-value {
    font-size: 10px;
    color: #666;
    font-family: monospace;
}

/* Elements tree */
.debug-elements-tree {
    font-family: inherit;
    font-size: 12px;
}

.debug-element {
    padding: 2px 8px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.debug-element:hover {
    background: #2d2d2d;
}

.debug-element.selected {
    background: #094771;
}

.debug-element-tag {
    color: #569cd6;
    margin-right: 4px;
}

.debug-element-class {
    color: #9cdcfe;
}

.debug-element-id {
    color: #d7ba7d;
}

/* Performance metrics */
.debug-metrics {
    display: grid;
    gap: 8px;
}

.debug-metric {
    background: #2d2d2d;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
}

.debug-metric-label {
    color: #9e9e9e;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.debug-metric-value {
    color: #cccccc;
    font-size: 16px;
    font-weight: 500;
}

/* Console output */
.debug-console {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.debug-console-line {
    padding: 2px 0;
    display: flex;
    align-items: flex-start;
}

.debug-console-timestamp {
    color: #666;
    margin-right: 8px;
    font-size: 10px;
    flex-shrink: 0;
}

.debug-console-message {
    flex: 1;
}

.debug-console-error {
    color: #f48771;
}

.debug-console-warning {
    color: #dcdcaa;
}

.debug-console-info {
    color: #4fc1ff;
}

/* Toggle button */
.debug-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #007acc;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    z-index: 9998;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 122, 204, 0.3);
}

.debug-toggle:hover {
    background: #005a9e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.4);
}

/* Grid overlay */
.debug-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: 
        linear-gradient(rgba(0, 122, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 122, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Tooltip */
.debug-tooltip {
    position: absolute;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    max-width: 400px;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* Enhanced color items */
.debug-color-item {
    cursor: pointer;
    position: relative;
}

.debug-color-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.debug-color-item:active {
    transform: translateY(0);
}

/* Copy indicator */
.debug-color-item::after {
    content: '📋';
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.debug-color-item:hover::after {
    opacity: 1;
}

/* Better panel header */
.debug-panel-header {
    background: linear-gradient(to bottom, #2d2d2d, #252526);
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    user-select: none;
}

.debug-panel-title {
    color: #cccccc;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-panel-close {
    background: none;
    border: none;
    color: #cccccc;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.debug-panel-close:hover {
    background: #333;
    color: #fff;
}

/* Enhanced tabs */
.debug-panel-tabs {
    background: #252526;
    border-bottom: 1px solid #333;
    display: flex;
    flex-shrink: 0;
    overflow-x: auto;
}

.debug-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    color: #9e9e9e;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
}

.debug-tab:hover {
    color: #cccccc;
    background: #2d2d2d;
}

.debug-tab.active {
    color: #007acc;
    border-bottom-color: #007acc;
    background: #1e1e1e;
}

.debug-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #007acc;
}

/* Minimize button */
.debug-panel-minimize {
    background: none;
    border: none;
    color: #cccccc;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
}

.debug-panel-minimize:hover {
    background: #333;
    color: #fff;
}

/* Minimized state */
.debug-panel.minimized {
    height: auto !important;
}

.debug-panel.minimized .debug-panel-content,
.debug-panel.minimized .debug-panel-tabs {
    display: none;
}

.debug-panel.minimized {
    width: 200px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .debug-panel {
        width: 100%;
    }
    
    .debug-colors-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
