/* --- FONTS --- */
@font-face {
    font-family: 'BSWFont';
    src: url('../assets/font.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}
@font-face {
    font-family: 'BSWFontBody';
    src: url('../assets/fontS.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bsw-violett: rgb(121, 35, 81);
    --bsw-pink: rgb(207, 0, 85);
    --bsw-orange: rgb(238, 116, 2);
    --bg-dark: #121212;
    --panel-bg: #1e1e1e;
    --text-main: #ffffff;
}

body {
    font-family: 'BSWFontBody', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 350px;
    background: var(--panel-bg);
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    z-index: 100; /* Sidebar über allem */
}

.sidebar-header {
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group {
    background: #252525;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #333;
}

.control-group label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--bsw-orange);
    margin-bottom: 8px;
    font-weight: bold;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    background: #333;
    border: 1px solid #555;
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-family: inherit;
    box-sizing: border-box;
    font-size: 14px;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--bsw-orange);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.2s;
    font-size: 1rem;
    color: white;
}
.btn-primary {
    background: linear-gradient(90deg, var(--bsw-pink), var(--bsw-orange));
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.btn-primary:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 15px rgba(207,0,85,0.4); 
}

/* LOGO GRID */
.logo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}
.logo-item {
    aspect-ratio: 1;
    border: 2px solid #444;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #fff;
    border-radius: 4px;
}
.logo-item.active {
    border-color: var(--bsw-orange);
    box-shadow: 0 0 10px rgba(238,116,2,0.5);
}

/* MAIN STAGE */
.main-stage {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 40px;
    /* Kleines Raster im Hintergrund der App zur Orientierung */
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 20px 20px; 
}

#canvasContainer {
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    /* Kein Border hier, der Border ist am logoCanvas, wenn gewünscht */
}

#logoCanvas {
    position: relative;
    overflow: hidden; 
    /* Standardgröße initial */
    width: 800px;
    height: 800px;
    background-color: white;
}

/* Schachbrettmuster für Transparenz-Anzeige */
.transparent-bg {
    background-color: #fff; /* Fallback */
    background-image: 
      linear-gradient(45deg, #ccc 25%, transparent 25%), 
      linear-gradient(-45deg, #ccc 25%, transparent 25%), 
      linear-gradient(45deg, transparent 75%, #ccc 75%), 
      linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* DRAGGABLE ITEMS */
.draggable-item {
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    user-select: none;
    border: 1px dashed rgba(121, 35, 81, 0.0); /* Default unsichtbar */
    line-height: 1.0;
}
.draggable-item:hover {
    border-color: var(--bsw-orange); /* Hover zeigt Rahmen */
    background-color: rgba(255,255,255,0.1);
}
.draggable-item:active {
    cursor: grabbing;
    border-color: var(--bsw-orange);
}

/* Z-INDEX REIHENFOLGE (WICHTIG!) */
#logoWrapper {
    z-index: 10; /* Unten */
    transform-origin: center center;
}
#patchElement {
    z-index: 20; /* Mitte */
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    transform-origin: top left; 
}
#textElement {
    z-index: 30; /* Oben */
    font-size: 60px;
    white-space: nowrap;
    transform-origin: center center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#bgImage {
    display: block;
    pointer-events: none; /* Klicks gehen durch aufs DIV */
    max-width: none; /* Bild darf Originalgröße haben */
}

/* Hilfsklasse: Wird beim Speichern hinzugefügt */
.no-border {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}
/* Hilfsklasse: Entfernt Schachbrett beim Speichern */
.no-bg-pattern {
    background-image: none !important;
}
