/* Tabbed Drawer Styles - Compact, Space-Efficient Design */

/* CSS Variables */
:root {
    --drawer-bg: #14141f;
    --drawer-border: #2a2a3a;
    --drawer-elevated: #1e1e2e;
    --drawer-content-bg: #252535;
    --accent-color: #00ffff;
    --accent-dim: #00aaaa;
    --text-primary: #ffffff;
    --text-secondary: #888899;
    --text-muted: #555566;
    --handle-height: 20px;
    --tab-height: 48px;
    --drawer-min-height: 100px;
    --drawer-max-height: 380px;
    --drawer-desktop-width: 340px;
    --slider-height: 8px;
    --slider-thumb: 20px;
}

/* Drawer Container */
.tabbed-drawer-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--drawer-bg);
    border-top: 1px solid var(--drawer-border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.tabbed-drawer-container.collapsed {
    transform: translateY(calc(100% - var(--tab-height)));
}

/* Desktop: Floating panel */
@media (min-width: 1024px) {
    .tabbed-drawer-container {
        left: auto;
        right: 16px;
        bottom: 16px;
        width: var(--drawer-desktop-width);
        border: 1px solid var(--drawer-border);
        border-radius: 12px;
        border-top: none;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    }

    .tabbed-drawer-container.collapsed {
        transform: translateY(0);
    }
}

/* Drawer Handle (drag to resize) */
.drawer-handle {
    height: var(--handle-height);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    background: var(--drawer-elevated);
    border-bottom: 1px solid var(--drawer-border);
    border-radius: 12px 12px 0 0;
    touch-action: none;
}

.drawer-handle:active {
    cursor: grabbing;
}

.drawer-handle::before {
    content: "";
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background 0.2s;
}

.drawer-handle:hover::before {
    background: var(--text-secondary);
}

@media (min-width: 1024px) {
    .drawer-handle {
        border-radius: 12px 12px 0 0;
    }
}

/* Tabs Navigation - Compact */
.drawer-tabs {
    display: flex;
    background: var(--drawer-elevated);
    border-bottom: 1px solid var(--drawer-border);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.drawer-tabs::-webkit-scrollbar {
    display: none;
}

.drawer-tab {
    flex: 1;
    min-width: 50px;
    padding: 6px 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    outline: none;
}

.drawer-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.drawer-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.drawer-tab:focus-visible {
    background: rgba(255, 255, 255, 0.05);
}

.drawer-tab.active {
    color: var(--accent-color);
    background: rgba(0, 255, 255, 0.06);
    border-bottom: 2px solid var(--accent-color);
}

/* Drawer Content Area - Compact height */
.drawer-content {
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    scroll-behavior: smooth;
}

@media (max-width: 480px) {
    .drawer-content {
        height: 180px;
        padding: 6px;
    }
}

@media (min-width: 1024px) {
    .drawer-content {
        height: 240px;
        max-height: 45vh;
    }
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: drawerFadeIn 0.2s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes drawerFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Cards - More compact */
.section-card {
    background: var(--drawer-content-bg);
    border-radius: 6px;
    margin-bottom: 6px;
    overflow: hidden;
    border: 1px solid var(--drawer-border);
    transition: border-color 0.2s;
}

.section-card:hover {
    border-color: rgba(0, 255, 255, 0.2);
}

.section-card:last-child {
    margin-bottom: 0;
}

.section-card.collapsed {
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: var(--drawer-border);
}

.section-header {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.section-title svg {
    width: 16px;
    height: 16px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.section-toggle {
    color: var(--text-muted);
    width: 14px;
    height: 14px;
    transition:
        transform 0.2s,
        color 0.2s;
    flex-shrink: 0;
}

.section-card.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.section-header:hover .section-toggle {
    color: var(--text-secondary);
}

.section-body {
    padding: 0 8px 8px;
    transition:
        max-height 0.25s ease,
        opacity 0.15s,
        padding 0.25s ease;
}

.section-card.collapsed .section-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* Control Rows - Compact */
.control-row {
    margin-bottom: 8px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.control-label span {
    font-size: 10px;
    color: var(--text-secondary);
}

.control-value {
    font-size: 10px;
    color: var(--accent-color);
    font-weight: 500;
    font-family: "SF Mono", Monaco, "Courier New", monospace;
}

/* Slider Row */
.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-row input[type="range"] {
    flex: 1;
    min-width: 0;
}

/* Range Input Styles - Larger, more visible */
input[type="range"] {
    height: var(--slider-height);
    background: var(--drawer-elevated);
    border-radius: calc(var(--slider-height) / 2);
    appearance: none;
    cursor: pointer;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: var(--slider-thumb);
    height: var(--slider-thumb);
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition:
        transform 0.12s,
        box-shadow 0.12s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--drawer-bg);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-webkit-slider-thumb:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: var(--slider-thumb);
    height: var(--slider-thumb);
    background: var(--accent-color);
    border: 2px solid var(--drawer-bg);
    border-radius: 50%;
    cursor: pointer;
    transition:
        transform 0.12s,
        box-shadow 0.12s;
}

/* Number Input - Compact */
input[type="number"] {
    width: 60px;
    padding: 6px 8px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 12px;
    text-align: center;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color);
}

input[type="number"]::-webkit-inner-spin-button {
    opacity: 1;
}

/* Select Styles - Compact */
select {
    width: 100%;
    padding: 8px 10px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23888899' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    transition: border-color 0.2s;
}

select:hover {
    border-color: var(--accent-dim);
}

select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Shape Grid - Responsive Auto-fit */
.shape-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
    gap: 6px;
    min-width: 0;
}

@media (max-width: 360px) {
    .shape-grid {
        grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
        gap: 4px;
    }
}

.shape-btn {
    aspect-ratio: 1;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    padding: 6px 4px;
}

.shape-btn svg {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.shape-btn span {
    font-size: 9px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

.shape-btn:hover {
    border-color: var(--accent-dim);
    background: rgba(0, 255, 255, 0.05);
}

.shape-btn:hover svg {
    color: var(--text-secondary);
}

.shape-btn:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
}

.shape-btn.selected,
.shape-btn.active {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.1);
}

.shape-btn.selected svg,
.shape-btn.active svg {
    color: var(--accent-color);
}

.shape-btn.selected span,
.shape-btn.active span {
    color: var(--accent-color);
}

/* Color Picker Row - Compact */
.color-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--drawer-border);
    cursor: pointer;
    transition:
        transform 0.12s,
        border-color 0.12s;
    flex-shrink: 0;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch:focus-visible {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow:
        0 0 0 2px var(--drawer-bg),
        0 0 0 4px var(--accent-color);
    transform: scale(1.1);
}

.custom-color-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-color-wrapper input[type="color"] {
    width: 36px;
    height: 28px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 2px;
    background: var(--drawer-elevated);
}

.custom-color-wrapper label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Preset Chips - Compact */
.preset-row {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.preset-row::-webkit-scrollbar {
    display: none;
}

.preset-chip {
    flex-shrink: 0;
    padding: 4px 8px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 12px;
    font-size: 9px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    outline: none;
}

.preset-chip:hover {
    border-color: var(--accent-dim);
    color: var(--text-primary);
}

.preset-chip:focus-visible {
    border-color: var(--accent-color);
}

.preset-chip.active {
    background: rgba(0, 255, 255, 0.12);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Toggle Switch - Compact */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
}

.toggle-label {
    font-size: 12px;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    background: var(--drawer-elevated);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.toggle-switch:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.3);
}

.toggle-switch.active {
    background: var(--accent-color);
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::after {
    transform: translateX(18px);
}

/* Action Buttons - Compact */
.action-row {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--drawer-border);
}

.action-btn {
    flex: 1;
    padding: 6px 10px;
    background: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: #0a0a0f;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition:
        opacity 0.2s,
        transform 0.08s;
    outline: none;
}

.action-btn:hover {
    opacity: 0.9;
}

.action-btn:active {
    transform: scale(0.97);
}

.action-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.3);
}

.action-btn.secondary {
    background: var(--drawer-elevated);
    color: var(--text-primary);
    border: 1px solid var(--drawer-border);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

/* Checkbox styling - Compact */
.checkbox-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.checkbox-row label {
    font-size: 11px;
    color: var(--text-primary);
    cursor: pointer;
}

/* Radio Group - Compact */
.radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
}

.radio-group input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

/* Mode Selector - Compact Toggle */
.mode-selector {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.mode-btn {
    padding: 6px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    outline: none;
    flex: 1;
    max-width: 90px;
}

.mode-btn svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.mode-btn span {
    font-size: 8px;
    line-height: 1.1;
    white-space: normal;
    text-align: center;
    max-width: 100%;
}

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

.mode-btn:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
}

.mode-btn.active {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.15);
    color: var(--accent-color);
}

.mode-btn.active svg {
    color: var(--accent-color);
}

/* Line Style Selector - Compact Toggle */
.line-style-selector {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
}

.line-style-btn {
    padding: 4px 6px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    outline: none;
    flex: 1;
}

.line-style-btn svg {
    flex-shrink: 0;
}

.line-style-btn span {
    font-size: 8px;
    line-height: 1.1;
    white-space: nowrap;
}

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

.line-style-btn:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
}

.line-style-btn.active {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.15);
    color: var(--accent-color);
}

.line-style-btn.active svg {
    color: var(--accent-color);
}

/* Nib Shape Selector - Compact Toggle */
.nib-shape-selector {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
}

.nib-shape-btn {
    padding: 4px 6px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    outline: none;
    flex: 1;
}

.nib-shape-btn svg {
    flex-shrink: 0;
}

.nib-shape-btn span {
    font-size: 8px;
    line-height: 1.1;
    white-space: nowrap;
}

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

.nib-shape-btn:focus-visible {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
}

.nib-shape-btn.active {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.15);
    color: var(--accent-color);
}

.nib-shape-btn.active svg {
    color: var(--accent-color);
}

/* Mode + Size Inline Row */
.mode-size-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.mode-size-row .mode-selector {
    flex-shrink: 0;
    margin-bottom: 0;
}

.mode-size-row .control-row {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

/* Layer List - Compact */
.drawer-layer-list {
    max-height: 120px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.layer-item:last-child {
    margin-bottom: 0;
}

.layer-item:hover {
    border-color: var(--accent-dim);
}

.layer-item.active {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.08);
}

.layer-item-name {
    font-size: 11px;
    color: var(--text-primary);
}

.layer-item-actions {
    display: flex;
    gap: 6px;
}

.layer-delete-btn {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.layer-delete-btn:hover {
    color: #ff5555;
    background: rgba(255, 85, 85, 0.1);
}

/* Layer count badge */
.layer-count {
    font-size: 10px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--drawer-elevated);
    border-radius: 10px;
}

/* Drawer Layer Items - Used in tabbed drawer panel */
.drawer-layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.drawer-layer-item:hover {
    border-color: var(--accent-dim);
    background: rgba(0, 255, 255, 0.05);
}

.drawer-layer-item.active {
    border-color: var(--accent-color);
    background: rgba(0, 255, 255, 0.1);
}

.drawer-layer-item:last-child {
    margin-bottom: 0;
}

.drawer-layer-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.drawer-layer-info {
    flex: 1;
    min-width: 0;
}

.drawer-layer-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-layer-params {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* FAB Actions Container - Top Right - Vertical Stack */
.fab-actions {
    position: fixed;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1001;
    align-items: flex-end;
}

/* FAB Group (for nested FABs like Layers + Share) */
.fab-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.fab-group .nested-fab {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
}

.fab-group:hover .nested-fab,
.fab-group.expanded .nested-fab {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.fab-actions .fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fab-actions .fab svg {
    width: 20px;
    height: 20px;
}

.fab-actions .fab:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.fab-actions .fab:focus-visible {
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.3);
}

.fab-actions .fab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Undo/Redo FABs - Green styling */
.fab-actions .fab-undo,
.fab-actions .fab-redo {
    background: #2ecc71;
}

.fab-actions .fab-undo:hover:not(:disabled),
.fab-actions .fab-redo:hover:not(:disabled) {
    background: #27ae60;
}

/* Tooltips for fab-actions */
.fab-actions .fab[data-tooltip] {
    position: relative;
}

.fab-actions .fab[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    background: #1a1a1a;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.fab-actions .fab[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Help button */
.fab-actions .fab-help {
    color: var(--accent-color);
}

/* Action buttons in drawer - More visible */
.drawer-fab {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--drawer-elevated);
    border: 1px solid var(--drawer-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.drawer-fab:hover {
    border-color: var(--accent-dim);
    color: var(--accent-color);
}

.drawer-fab svg {
    width: 16px;
    height: 16px;
}

/* Responsive adjustments */
@media (max-width: 360px) {
    :root {
        --tab-height: 44px;
        --drawer-content-height: 240px;
    }

    .drawer-tab {
        min-width: 50px;
        padding: 6px 4px;
        font-size: 9px;
    }

    .drawer-tab svg {
        width: 18px;
        height: 18px;
    }

    .shape-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .shape-btn {
        padding: 4px 2px;
    }

    .shape-btn svg {
        width: 16px;
        height: 16px;
    }

    .shape-btn span {
        font-size: 7px * Scroll;
    }
}

/* Scrollbar styling */
.drawer-content::-webkit-scrollbar {
    width: 6px;
}

.drawer-content::-webkit-scrollbar-track {
    background: var(--drawer-bg);
}

.drawer-content::-webkit-scrollbar-thumb {
    background: var(--drawer-border);
    border-radius: 3px;
}

.drawer-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Dense Control Grid */
.control-grid {
    display: grid;
    grid-template-columns: min-content 1fr;
    gap: 8px 12px;
    align-items: center;
    padding: 0 4px;
}

.control-grid label {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

.control-grid .slider-row,
.control-grid .toggle-row {
    margin-bottom: 0;
    min-width: 0;
    width: 100%;
}

/* Hide UI Mode */
body.ui-hidden .tabbed-drawer-container,
body.ui-hidden .mobile-panels,
body.ui-hidden .mobile-tab-bar {
    display: none !important;
}

body.ui-hidden .fab-actions> :not(#hideUiFab) {
    display: none !important;
}

/* Ensure Hide UI FAB remains visible and positioned correctly */
body.ui-hidden #hideUiFab {
    opacity: 0.8;
}

body.ui-hidden #hideUiFab:hover {
    opacity: 1;
}