@import "tailwindcss";
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  --bg: #0f1419;
  --bg-2: #141c24;
  --panel: #18212b;
  --panel-2: #1d2732;
  --border: #2a3543;
  --text: #e7edf3;
  --muted: #9aa8b4;
  --accent: #f6c177;
  --accent-2: #7dd3b0;
  --danger: #ff6b6b;
  --canvas-bg: #1a1a2e;
  --shadow: rgba(0, 0, 0, 0.35);
}

body {
  font-family: "Space Grotesk", "Fira Sans", "Segoe UI", sans-serif;
  background:
      radial-gradient(1200px 800px at 15% 10%, #1b2530 0%, #0f1419 55%),
      linear-gradient(135deg, #0f1419, #141c24);
  color: var(--text);
  min-height: 100vh;
  /* display: flex; flex-direction: column;  -- Handled by Vue App layout */
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(15, 20, 25, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #f0b365);
    color: #1b1308;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 6px 16px rgba(246, 193, 119, 0.35);
}

.brand-text .title {
    font-size: 18px;
    font-weight: 600;
}

.brand-text .subtitle {
    font-size: 12px;
    color: var(--muted);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn {
    border: 1px solid transparent;
    background: var(--panel-2);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn.small {
    padding: 6px 10px;
    font-size: 12px;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #f0b365);
    color: #1b1308;
    box-shadow: 0 8px 18px rgba(246, 193, 119, 0.35);
}

.btn.ghost {
    background: transparent;
    border-color: var(--border);
}

.btn.danger {
    border-color: rgba(255, 107, 107, 0.4);
    color: #ffd1d1;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px 1fr 320px;
}

.sidebar {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    height: calc(100vh - 66px); /* Adjust based on topbar height */
}

.sidebar.left {
    border-right: 1px solid var(--border);
}

.sidebar.right {
    border-left: 1px solid var(--border);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 8px 18px var(--shadow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.panel-header h3 {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.panel-hint {
    font-size: 11px;
    color: var(--muted);
}

.element-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.element-btn {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease;
}

.element-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.element-title {
    font-size: 13px;
    font-weight: 600;
}

.element-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    display: block;
}

.screen-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.screen-item {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    text-align: left;
    color: var(--text);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.screen-item.active {
    border-color: var(--accent-2);
    box-shadow: 0 0 0 2px rgba(125, 211, 176, 0.2);
}

.screen-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(125, 211, 176, 0.15);
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.screen-name {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.screen-settings {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tree-root {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.tree-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.tree-item.active {
    border-color: var(--accent-2);
    box-shadow: 0 0 0 2px rgba(125, 211, 176, 0.2);
}

.tree-item.hidden {
    opacity: 0.5;
}

.tree-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(125, 211, 176, 0.15);
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tree-name {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-id {
    font-size: 11px;
    color: var(--muted);
}

.tree-empty {
    font-size: 12px;
    color: var(--muted);
    padding: 6px 0;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.control-row label {
    font-size: 12px;
    color: var(--muted);
}

.control-row input[type="color"] {
    width: 44px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
}

.control-row input[type="range"] {
    flex: 1;
}

.control-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.canvas-area {
    padding: 20px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-shell {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(20, 28, 36, 0.7);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 20px 40px rgba(0, 0, 0, 0.4);
}

.canvas {
    position: relative;
    background: var(--canvas-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.canvas::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: var(--grid-size, 32px) var(--grid-size, 32px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.canvas.grid-off::before {
    opacity: 0;
}

.widget {
    /* Absolute positioning handled by component inline styles */
    position: absolute;
    cursor: move;
    user-select: none;
    touch-action: none;
    z-index: 1;
}

.widget.selected {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.resize-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--accent);
    border: 2px solid #1b1308;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    cursor: se-resize;
    z-index: 2;
}

.resize-handle::before {
    content: "";
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 6px;
    height: 6px;
    border-right: 2px solid rgba(27, 19, 8, 0.65);
    border-bottom: 2px solid rgba(27, 19, 8, 0.65);
    border-radius: 2px;
}

.widget-label {
    padding: 4px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.widget-button {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.widget-led {
    border-radius: 999px;
}

.properties h4 {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 16px 0 10px;
}

.prop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.prop-row label {
    width: 90px;
    font-size: 12px;
    color: var(--muted);
}

.prop-row input,
.prop-row select {
    flex: 1;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    color: var(--text);
    font-size: 12px;
}

.prop-row input[type="color"] {
    padding: 2px;
    height: 30px;
    cursor: pointer;
}

.prop-row input[type="checkbox"] {
    width: auto;
    flex: none;
}

.prop-actions {
    margin-top: 16px;
}

.no-selection {
    color: var(--muted);
    text-align: center;
    padding: 20px 10px;
    font-size: 13px;
}

.status {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #1b1308;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.status.show { opacity: 1; }
.status.error {
    background: var(--danger);
    color: #1b0f0f;
}

@media (max-width: 1100px) {
    .workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .sidebar.left {
        order: 1;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .canvas-area {
        order: 2;
    }

    .sidebar.right {
        order: 3;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

/* Material Symbols Icon Font */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

.widget-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
