/* Tembo Explorer Styles */

/* Reset for component */
.tembo-explorer * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.tembo-explorer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #B3A594;
    color: #513B27;
}

/* Use this class if embedding as full page */
.tembo-explorer.full-page {
    min-height: 100vh;
}

.tembo-explorer .container {
    display: flex;
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px;
    gap: 40px;
    align-items: flex-start;
}

/* Left Sidebar */
.tembo-explorer .sidebar {
    width: 240px;
    flex-shrink: 0;
}

.tembo-explorer .title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #513B27;
}

.tembo-explorer .subtitle {
    font-size: 12px;
    color: #7a6b5a;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Feature Tags */
.tembo-explorer .feature-tags {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Back Panel Label */
.tembo-explorer .back-panel-label {
    font-size: 11px;
    color: #7a6b5a;
    font-style: italic;
    margin-top: 24px;
    margin-bottom: 8px;
}

.tembo-explorer .tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tembo-explorer .feature-tag {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #513B27;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: #513B27;
    white-space: nowrap;
}

.tembo-explorer .feature-tag:hover {
    background-color: rgba(81, 59, 39, 0.1);
}

.tembo-explorer .feature-tag.active {
    background-color: #513B27;
    color: #E8E1D4;
}

/* Main Content */
.tembo-explorer .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Device Wrapper - Contains both panels */
.tembo-explorer .device-wrapper {
    width: 100%;
    max-width: 689px;
}

/* Device Container - Responsive */
.tembo-explorer .device-container {
    position: relative;
    width: 100%;
    aspect-ratio: 689 / 555;
}

/* Panel Separator */
.tembo-explorer .panel-separator {
    width: 100%;
    margin: 16px 0 8px 0;
}

.tembo-explorer .separator-sketch {
    width: 100%;
    height: 40px;
    display: block;
}

/* Back Panel */
.tembo-explorer .device-container.back-panel {
    aspect-ratio: 688 / 144;
    flex: 1;
    min-width: 0;
}

.tembo-explorer .device-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tembo-explorer .highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tembo-explorer .highlight-overlay rect {
    pointer-events: all;
}

/* Highlight rectangles */
.tembo-explorer .highlight-rect {
    fill: transparent;
    stroke: transparent;
    cursor: pointer;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.tembo-explorer .highlight-rect:hover {
    fill: rgba(255, 180, 80, 0.15);
}

.tembo-explorer .highlight-rect.highlighted {
    fill: rgba(255, 180, 80, 0.3);
    stroke: rgba(200, 130, 40, 0.7);
    stroke-width: 2;
}

/* Tooltip */
.tembo-tooltip {
    position: fixed;
    background-color: #E8E1D4;
    color: #513B27;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    max-width: 180px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.tembo-tooltip.visible {
    opacity: 1;
}

.tembo-tooltip .tooltip-title {
    display: none;
}

.tembo-tooltip .tooltip-desc {
    font-size: 13px;
    line-height: 1.4;
}

/* Editor Mode (optional - can be removed for production) */
.tembo-explorer .editor-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #513B27;
    color: #E8E1D4;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 1001;
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.tembo-explorer .editor-panel h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tembo-explorer .editor-panel .close-btn {
    background: none;
    border: none;
    color: #E8E1D4;
    cursor: pointer;
    font-size: 18px;
}

.tembo-explorer .editor-panel label {
    display: block;
    margin: 8px 0 4px;
    font-weight: 500;
}

.tembo-explorer .editor-panel select,
.tembo-explorer .editor-panel input {
    width: 100%;
    padding: 6px;
    border: 1px solid #7a6b5a;
    border-radius: 4px;
    background: #E8E1D4;
    color: #513B27;
    font-size: 12px;
}

.tembo-explorer .editor-panel .coords-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tembo-explorer .editor-panel .coords-row label {
    margin: 4px 0 2px;
}

.tembo-explorer .editor-panel button {
    margin-top: 12px;
    padding: 8px 12px;
    background: #E8E1D4;
    color: #513B27;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
}

.tembo-explorer .editor-panel button:hover {
    background: #fff;
}

.tembo-explorer .editor-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 16px;
    background: #513B27;
    color: #E8E1D4;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.tembo-explorer .editor-toggle:hover {
    background: #3d2c1e;
}

.tembo-explorer .highlight-rect.editor-mode {
    stroke: rgba(100, 100, 255, 0.5);
    stroke-width: 1;
    stroke-dasharray: 4;
}

.tembo-explorer .highlight-rect.editor-selected {
    stroke: #ff5555 !important;
    stroke-width: 2 !important;
    stroke-dasharray: none !important;
}

.tembo-explorer .feature-label {
    font-size: 8px;
    fill: #513B27;
    pointer-events: none;
    font-weight: bold;
}

.tembo-explorer .back-panel .feature-label {
    font-size: 6px;
}

.tembo-explorer .export-output {
    margin-top: 10px;
    padding: 8px;
    background: #3d2c1e;
    border-radius: 4px;
    font-family: monospace;
    font-size: 10px;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Responsive */
@media (max-width: 900px) {
    .tembo-explorer .container {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .tembo-explorer .sidebar {
        width: 100%;
    }

    .tembo-explorer .main-content {
        width: 100%;
    }

    .tembo-explorer .device-container {
        max-width: 100%;
    }

    .tembo-explorer .editor-panel {
        max-width: 240px;
        font-size: 11px;
    }

    .tembo-explorer .editor-toggle {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 11px;
    }
}

@media (max-width: 500px) {
    .tembo-explorer .container {
        padding: 15px;
    }

    .tembo-explorer .title {
        font-size: 20px;
    }

    .tembo-explorer .feature-tag {
        padding: 4px 8px;
        font-size: 11px;
    }

    .tembo-explorer .editor-panel {
        top: auto;
        bottom: 50px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Back to Lab link */
.back-to-lab {
    position: fixed;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #E8E1D4;
    border: 1px solid rgba(81, 59, 39, 0.2);
    border-radius: 20px;
    color: #7a6b5a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.back-to-lab:hover {
    background: #fff;
    color: #513B27;
    transform: translateX(-2px);
}
.back-to-lab svg {
    width: 16px;
    height: 16px;
}
