@font-face {
    font-family: 'ABIcons';
    src: url('../Armin_Bauke_Iconfont.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.ab-icon, .layer-visibility, .layer-lock {
    font-family: 'ABIcons' !important;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Icon-Größen */
.ab-icon { font-size: 1.3rem; vertical-align: middle; }
.layer-toolbar .ab-icon { font-size: 1.4rem; }
.layer-visibility, .layer-lock { font-size: 1.2rem; }

:root {
    --bg-color: #2c3e50;
    --panel-bg: #ecf0f1;
    --text-color: #2c3e50;
    --accent-color: #3498db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0; height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    position: relative;
}

#main-area { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }

#sidebar {
    position: fixed; top: 0; left: 0; width: 350px; height: 100%;
    background-color: var(--panel-bg);
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
    z-index: 10; min-width: 250px; max-width: 600px;
}

#sidebar.collapsed { transform: translateX(-100%); opacity: 0; pointer-events: none; }

#sidebarContent {
    padding: 15px; overflow-y: auto; flex: 1;
    display: flex; flex-direction: column; gap: 10px;
    scroll-behavior: smooth;
}

#resizeHandle {
    position: absolute; right: 0; top: 0; width: 10px; height: 100%;
    cursor: ew-resize; z-index: 25;
}
#resizeHandle:hover { background: rgba(52, 152, 219, 0.3); }

/* REITER STYLING */
.control-group {
    background: white; border-radius: 4px; padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex; flex-direction: column;
}

h2 { 
    margin: 0; font-size: 1.05rem; padding: 5px 0;
    cursor: grab; user-select: none;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee;
}
h2:active { cursor: grabbing; }
h2::after { content: '▼'; font-size: 0.7rem; transition: transform 0.2s; margin-left: 10px; }
h2.collapsed::after { transform: rotate(-90deg); }
h2.collapsed { border-bottom: none; }

.section-content { 
    overflow: hidden; transition: max-height 0.3s ease, opacity 0.2s; 
    max-height: 2000px; padding-top: 10px; opacity: 1;
    display: flex; flex-direction: column; gap: 10px;
}
.section-content.collapsed { max-height: 0; padding-top: 0; opacity: 0; pointer-events: none; }

#colorPicker { display: flex; justify-content: center; width: 100%; margin: 0 auto; }

/* FENSTER STYLING */
.floating-window {
    position: fixed; background: var(--panel-bg); border: 1px solid #ccc;
    border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 2000; width: 320px; display: flex; flex-direction: column;
    overflow: hidden; resize: both;
    min-width: 250px; min-height: 45px; max-height: 100vh;
}
.floating-window[data-minimized="true"] { resize: none !important; height: auto !important; }
.floating-header {
    background: var(--accent-color); color: white; padding: 10px 15px;
    cursor: move; display: flex; justify-content: space-between; align-items: center;
    user-select: none; min-height: 35px;
}
.floating-controls { 
    display: flex; 
    gap: 12px; /* MEHR ABSTAND */
}
.min-btn, .close-btn {
    background: rgba(255,255,255,0.2); border: none; color: white;
    width: 28px; height: 28px; border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; transition: background 0.2s;
}
.min-btn:hover, .close-btn:hover { background: rgba(255,255,255,0.4); }
.floating-content { padding: 15px; background: white; flex: 1; overflow-y: auto; }

/* AUSGRAUEN DER UNTEROPTIONEN */
.sub-options-disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

.drag-placeholder {
    background: rgba(52, 152, 219, 0.1); border: 2px dashed #3498db;
    border-radius: 4px; height: 100px; margin: 10px 0; pointer-events: none;
}

/* LAYOUT ELEMENTE */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row label { flex: 1; min-width: 100px; font-size: 0.85rem; }
.row input[type="number"], .row input[type="text"] { width: 75px; padding: 5px; border: 1px solid #ccc; border-radius: 3px; }

.color-inputs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; font-size: 0.85rem; }
.color-inputs-grid .row { gap: 5px; }
.color-inputs-grid label { min-width: 25px; flex: 0 0 25px; }
.color-inputs-grid input { width: 60px !important; flex: none !important; }

.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.symmetry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); gap: 5px; }

button { padding: 8px; border-radius: 4px; border: none; cursor: pointer; background: #ddd; font-weight: bold; font-size: 0.85rem; }
button.active { background: var(--accent-color); color: white; }
.export-btn { background: #27ae60; color: white; margin-top: 5px; width: 100%; }

#sidebarToggle {
    position: fixed; left: 350px; top: 10px; width: 35px; height: 35px;
    background: var(--accent-color); color: white; border: none; border-radius: 4px;
    cursor: pointer; z-index: 100; transition: left 0.3s ease;
}
body.sidebar-collapsed #sidebarToggle { left: 5px; }

canvas {
    display: block; width: 100%; height: 100%;
    background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%),
                      linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}
#canvas { cursor: crosshair; }
body.tool-eraser #canvas { cursor: none; }

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

.gallery-card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: var(--accent-color);
}

.gallery-card canvas {
    width: 100%;
    height: auto;
    display: block;
    background: #ecf0f1;
    cursor: pointer;
}

.gallery-card-info {
    padding: 5px 8px;
    border-top: 1px solid #eee;
}

.gallery-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-card-meta {
    font-size: 0.65rem;
    color: #95a5a6;
}

.gallery-loading {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* EBENEN / LAYERS */
.layer-toolbar { display: flex; gap: 4px; margin-bottom: 8px; }
.layer-toolbar button { flex: 1; padding: 5px; font-size: 0.85rem; }

.layer-list { display: flex; flex-direction: column; gap: 2px; }

.layer-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; border-radius: 4px;
    background: #f8f8f8; border: 2px solid transparent;
    cursor: grab; font-size: 0.85rem; user-select: none;
}
.layer-item:active { cursor: grabbing; }
.layer-item.active { border-color: var(--accent-color); background: #e8f4fd; }
.layer-item.locked { opacity: 0.6; }

.layer-visibility, .layer-lock {
    background: none; border: none; cursor: pointer;
    font-size: 0.9rem; padding: 2px; min-width: 24px;
}
.layer-thumb {
    width: 40px; height: 30px; border-radius: 3px;
    border: 1px solid #ccc; flex-shrink: 0; image-rendering: pixelated;
}
.layer-name {
    flex: 1; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; cursor: text;
}
.layer-name-edit {
    flex: 1; min-width: 0; padding: 1px 3px; border: 1px solid var(--accent-color);
    border-radius: 2px; font-size: 0.85rem; outline: none;
}
.layer-opacity { width: 50px; }

.layer-drag-ghost {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); border-radius: 4px;
}
.layer-drag-placeholder {
    background: rgba(52, 152, 219, 0.15); border: 2px dashed var(--accent-color);
    border-radius: 4px; margin: 1px 0;
}
/* HISTORIE / ITEM LIST */
.history-container { display: flex; gap: 6px; max-height: 300px; overflow-y: auto; overflow-x: hidden; }
.history-slider-col { display: flex; flex-direction: column; align-items: center; min-width: 24px; }
.history-slider-col input[type="range"] {
    writing-mode: vertical-lr;
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    flex: 1; width: 20px; min-height: 30px; cursor: pointer;
}
.history-pos { font-size: 0.7rem; color: #888; white-space: nowrap; text-align: center; margin-top: 4px; }

.item-list { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 30px; min-width: 0; }

.item-entry {
    display: flex; align-items: center; gap: 5px;
    padding: 4px 6px; border-radius: 4px;
    background: #f8f8f8; border: 2px solid transparent;
    cursor: grab; font-size: 0.78rem; user-select: none;
    transition: border-color 0.15s;
    min-height: 28px; box-sizing: border-box;
    overflow: hidden;
}
.item-entry:active { cursor: grabbing; }
.item-entry:hover { background: #eef5fc; }
.item-entry.current { border-color: var(--accent-color); background: #e8f4fd; }
.item-entry.highlighted { border-color: #FF00FF !important; background: #fce4ff !important; }
.item-entry.selected { border-color: #00CCCC; background: #e0fafa; }
.item-entry.future { opacity: 0.35; }
.item-num { font-size: 0.7rem; color: #999; min-width: 24px; text-align: right; flex-shrink: 0; }

.item-color {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1px solid #ccc; flex-shrink: 0;
}
.item-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-layer-select {
    font-size: 0.7rem; padding: 1px 2px; border: 1px solid #ccc;
    border-radius: 3px; background: #f0f0f0; max-width: 70px;
    cursor: pointer;
}
.item-delete {
    background: none; border: none; cursor: pointer;
    font-size: 0.85rem; padding: 2px; min-width: 20px; opacity: 0.4;
    color: inherit;
}
.item-delete:hover { opacity: 1; color: #e74c3c; }

.item-drag-ghost { box-shadow: 0 4px 12px rgba(0,0,0,0.3); border-radius: 4px; }
.item-drag-placeholder {
    background: rgba(52, 152, 219, 0.15); border: 2px dashed var(--accent-color);
    border-radius: 4px; height: 28px; margin: 1px 0;
}

.item-list-empty {
    text-align: center; color: #aaa; font-size: 0.8rem; padding: 10px;
    font-style: italic;
}

.layer-template-remove {
    background: none; border: none; cursor: pointer;
    font-size: 0.7rem; padding: 2px; min-width: 20px; opacity: 0.6;
}
.layer-template-remove:hover { opacity: 1; }