#tool-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 1rem;
    margin-left: -10px;
    width: 100%;
    height: 2.5rem;
    background-color: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
}

.toolbar-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-left {
    margin-right: auto;
}

.toolbar-center {
    position: absolute;
    left: 75%;
    transform: translateX(-50%);
    z-index: 10; /* Ensure it's above other elements */
    background: var(--color-bg-primary);
    padding: 0 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tool-bar-item {
    box-sizing: border-box;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    --bg-color: var(--color-toolbar-item-bg);
    --color: var(--color-toolbar-item);
    background-color: var(--bg-color);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 2rem;
    height: 2rem;
    padding: 0.25rem;
    position: relative;
}

.tool-bar-item::after {
    content: attr(title);
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 0.375rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tool-bar-item:hover::after {
    opacity: 1;
    transition-delay: 0.5s;
}

.tool-bar-item:hover {
    border-width: 0.125rem;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tool-bar-item:active {
    --bg-color: var(--color-toolbar-item-bg-active);
    transform: translateY(0);
}

.tool-active {
    --bg-color: #007bff !important;
    background-color: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
    /* Stronger blue halo */
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.7), 0 0 24px rgba(0, 123, 255, 0.45) !important;
}

/* Estado ativo para botões de simulação: ícone cinza + auréola azul */
.sim-active {
    --color: #6a6a6a !important; /* cinza médio para ícones */
    /* Auréola azul igual aos outros ícones ativos */
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.7), 0 0 24px rgba(0, 123, 255, 0.45) !important;
}

/* Garantir que botões de simulação não tenham fundo azul quando ativos */
#sim-btn-step-game.sim-active,
#sim-btn-start.sim-active,
#sim-btn-pause.sim-active,
#sim-btn-stop.sim-active,
#sim-btn-restart.sim-active {
    background-color: transparent !important;
    --bg-color: transparent !important;
}

/* Forçar fill/stroke cinza em elementos internos dos botões de simulação ativos */
.tool-bar-item.sim-active path,
.tool-bar-item.sim-active rect,
.tool-bar-item.sim-active g {
    fill: #6a6a6a !important;
    stroke: #6a6a6a !important;
}

/* Unified later: token-tool-active-force standardized below */

.selected-tool-bar-item {
    --bg-color: #e6e6e6 !important;
    background-color: #e6e6e6 !important;
    border-color: #bfbfbf !important;
    border-width: 0.125rem;
    /* Stronger blue halo (same as Token Tool) */
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.7), 0 0 24px rgba(0, 123, 255, 0.45) !important;
}

/* Unified later: Place Tool uses ring + standard selected style */

/* Deprecated: .place-tool-active legacy styling removed in favor of .selected-tool-bar-item */

.tool-bar-separation {
    border: 1px solid var(--color-border);
    width: 0;
    height: 1.5rem;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

.file-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--color-bg-secondary);
    border-radius: 0.375rem;
    font-size: 0.85rem;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

#file-path {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
}

.file-modified-indicator {
    color: #f59e0b;
    font-size: 1.2rem;
    line-height: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Overrides: standardize active tool icons to gray */
#place-tool.selected-tool-bar-item,
#mouse-tool.selected-tool-bar-item,
#trans-tool.selected-tool-bar-item,
#arc-tool.selected-tool-bar-item,
#token-tool.selected-tool-bar-item {
    --bg-color: #e6e6e6 !important;
    background-color: #e6e6e6 !important;
    border-color: #bfbfbf !important;
    /* Stronger blue halo */
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.7), 0 0 24px rgba(0, 123, 255, 0.45) !important;
}

#place-tool.selected-tool-bar-item *,
#mouse-tool.selected-tool-bar-item *,
#trans-tool.selected-tool-bar-item *,
#arc-tool.selected-tool-bar-item *,
#token-tool.selected-tool-bar-item * {
    stroke: #6a6a6a !important;
    fill: #6a6a6a !important;
}

/* Apply uniform gray inner styling for selected tool icons */
.selected-tool-bar-item svg path,
.selected-tool-bar-item svg rect,
.selected-tool-bar-item svg g {
    stroke: #6a6a6a !important;
    fill: #6a6a6a !important;
}

.token-tool-active-force {
    --bg-color: #e6e6e6 !important;
    background-color: #e6e6e6 !important;
    border-color: #bfbfbf !important;
    /* Stronger blue halo */
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.7), 0 0 24px rgba(0, 123, 255, 0.45) !important;
}

/* Mode-based dimming: keep icons visible but subdued and non-interactive */
.tool-bar-item.mode-disabled {
    opacity: 0.4 !important;
    filter: grayscale(60%);
    cursor: not-allowed !important;
}
.tool-bar-item.mode-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}
.tool-bar-item.mode-disabled * {
    stroke: #9aa0a6 !important; /* soft gray for inner shapes */
    fill: #9aa0a6 !important;
}

/* Override: Place Tool active should look like a ring, not a filled dot */
#place-tool.selected-tool-bar-item circle {
    fill: none !important;
    stroke: #6a6a6a !important;
    stroke-width: 3px !important;
}