/* --- SCHRIFTARTEN --- */
@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;
}

/* --- VARIABLEN --- */
:root {
    --bsw-violett: rgb(121, 35, 81);
    --bsw-pink: rgb(207, 0, 85);
    --bsw-orange: rgb(238, 116, 2);
    --bsw-yellow: rgb(255, 204, 0); 
    --bg-dark: #121212;
    --panel-bg: #1e1e1e;
    --text-main: #ffffff;
    --input-bg: #2b2b2b;
    --border-col: #444;
}

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

/* --- SIDEBAR --- */
.sidebar {
    width: 400px;
    background: var(--panel-bg);
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid var(--border-col);
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-col);
    padding-bottom: 10px;
    margin-bottom: 5px;
}

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

.control-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #bbb;
    margin-bottom: 6px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* FARBWAHL */
.color-picker-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.active { border-color: white; box-shadow: 0 0 0 2px var(--bsw-orange); transform: scale(1.1); }

.checkbox-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 10px;
    font-size: 13px;
    color: #ccc;
}
.checkbox-row input { width: auto; margin: 0; }

.hidden { display: none !important; }

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-col);
    color: white;
    padding: 10px;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 8px;
}
/* Spezifisches Styling für Textareas damit sie kompakt wirken */
textarea.compact {
    height: auto;
    min-height: 40px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--bsw-orange);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 8px;
    transition: all 0.2s;
    text-transform: uppercase;
    font-size: 0.85rem;
    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(-1px); box-shadow: 0 6px 15px rgba(207,0,85,0.4); }

.btn-secondary { background: #444; border: 1px solid #666; color: #fff; }
.btn-secondary:hover { background: #555; }

.btn-info { 
    background: transparent; 
    color: #ccc; 
    border: none; 
    width: auto; 
    padding: 5px 10px; 
    font-size: 20px; 
    cursor: pointer;
}
.btn-info:hover { color: var(--bsw-orange); }

.btn-small { padding: 5px 10px; font-size: 0.7rem; width: auto; display: inline-block; margin: 0; }
.btn-mini { padding: 4px 8px; font-size: 0.65rem; background:#555; color:#ddd; border:1px solid #666; cursor:pointer; border-radius:3px; float:right; margin-top:-25px; }
.btn-mini:hover { background:#666; color:white; }

/* --- PIXABAY GALLERY --- */
.pixabay-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 10px;
}
.pix-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}
.pix-thumb:hover { transform: scale(1.05); }
.pix-thumb.selected { border-color: var(--bsw-orange); }

/* --- LOGO GRID --- */
.logo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.logo-item {
    width: 50px;
    height: 50px;
    border: 2px solid #555;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #eee;
    border-radius: 6px;
}
.logo-item.active {
    border-color: var(--bsw-orange);
    box-shadow: 0 0 8px rgba(238, 116, 2, 0.6);
}

/* --- PREVIEW STAGE --- */
.main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
    overflow: hidden; 
}

.toolbar {
    height: 45px;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    border-bottom: 1px solid #333;
}

#canvasContainer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 40px;
}

#printCanvas { 
    background: white; 
    box-shadow: 0 0 60px rgba(0,0,0,0.7); 
    transform-origin: center center;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    box-sizing: border-box;
}

/* --- PRINT TEMPLATE STYLES --- */

/* FLYER STYLES (A4/A5) */
.bsw-headline { 
    font-family: 'BSWFont', sans-serif;
    font-weight: bold; 
    text-transform: uppercase; 
    margin: 0;
    transform: skewX(-10deg); 
    transform-origin: bottom left;
    display: block;
    text-align: left;
}

.bsw-subline { 
    font-family: 'BSWFont', sans-serif;
    font-weight: bold; 
    line-height: 1.1; 
    text-align: left;
}

.bsw-body { 
    font-family: 'BSWFontBody', sans-serif;
    font-weight: normal; 
    line-height: 1.4; 
    white-space: pre-line; 
    text-align: left !important;
    width: 100%;
    display: block;
}

/* PLAKAT STYLES (A3/A2) */

.bsw-text-bg {
    background: linear-gradient(90deg, rgba(121,35,81,0.85) 0%, rgba(207,0,85,0.85) 50%, rgba(238,116,2,0.85) 100%);
    
    /* ÄNDERUNG: Wir erweitern den bestehenden Schatten.
       1. Teil: Dein originaler Schlagschatten (5px 5px...)
       2. Teil: Ein 1px Schatten in Pink, der den Riss "zukittet"
    */
    box-shadow: 5px 5px 0 rgba(0,0,0,0.2), 0 0 1px var(--bsw-pink);
    
    box-decoration-break: slice;
    -webkit-box-decoration-break: slice; 
    
    display: inline;
    padding: 0.35em 0.2em 0.05em 0.2em; 
    
    line-height: 1.35;
    transform: skewX(-10deg);
    color: white;
    
    /* NEU: Erzwingt GPU-Rendering, hilft oft gegen Artefakte */
    transform-style: preserve-3d;
}

.plakat-h1 {
    font-family: 'BSWFont', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 0.2em;
    transform: skewX(-10deg); 
    transform-origin: bottom left;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.6);
    display: inline-block;
    text-align: left;
}

.plakat-h2 {
    font-family: 'BSWFont', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 0;
    display: inline; /* Inline für den Background Flow */
    vertical-align: middle;
}

.plakat-stoerer {
    font-family: 'BSWFont', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    background-color: var(--bsw-yellow);
    color: #000;
    padding: 0.25em 0.5em 0.1em 0.5em;
    display: inline-block;
    transform: skewX(-10deg) rotate(-2deg);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
    margin-top: 0.3em;
    text-align: center;
}

.bsw-footer {
    width: 100%; 
    font-size: 6pt !important;
    color: #555; 
    border-top: 1px solid #ddd; 
    padding-top: 4px;
    font-family: 'BSWFontBody', sans-serif;
    text-align: left;
}

.plakat-footer-overlay {
    font-family: 'BSWFontBody', sans-serif;
    font-size: 8pt;
    color: white;
    text-shadow: 1px 1px 3px black, 0 0 1em black;
    opacity: 0.9;
    text-align: center;
    width: 100%;
}

.bsw-gradient-bar {
    background: linear-gradient(90deg, rgba(121,35,81,1) 0%, rgba(207,0,85,1) 50%, rgba(238,116,2,1) 100%);
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0% 100%);
    z-index: 10;
}

.logo-container {
    transition: padding 0.2s, background-color 0.2s;
    cursor: grab; 
    overflow: visible; 
    position: absolute;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-container:active { cursor: grabbing; }

.logo-container.bg-white {
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
}
.logo-container.bg-none {
    background: transparent;
    filter: drop-shadow(0 0 15px rgba(255,255,255,0.9));
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; 
    pointer-events: none;
    user-select: none;
}

/* Positioning Classes */
.pos-tr { top: 0; right: 0; border-bottom-left-radius: 40px; transform-origin: top right; }
.pos-tl { top: 0; left: 0; border-bottom-right-radius: 40px; transform-origin: top left; }
.pos-br { bottom: 0; right: 0; border-top-left-radius: 40px; transform-origin: bottom right; }
.pos-bl { bottom: 0; left: 0; border-top-right-radius: 40px; transform-origin: bottom left; }

/* MODAL & TABS */
#loadingOverlay { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85); color:white; display:none; align-items:center; justify-content:center; flex-direction:column; z-index:9999; backdrop-filter: blur(5px); }
.modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.9); z-index:2000; padding:20px; box-sizing:border-box; }
.modal-content { max-width:600px; margin:50px auto; background:#222; padding:30px; border-radius:12px; border:1px solid #444; max-height: 85vh; overflow-y: auto; }
.close-modal { float:right; font-size:24px; cursor:pointer; }

.tab-nav { display:flex; gap:10px; margin-bottom:20px; border-bottom:1px solid #444; padding-bottom:10px; }
.tab-btn { background:none; border:none; color:#888; font-size:16px; cursor:pointer; padding:5px 10px; font-weight:bold; }
.tab-btn.active { color:var(--bsw-orange); border-bottom:2px solid var(--bsw-orange); }
.tab-content { display:none; line-height:1.6; color:#ddd; font-size:14px; }
.tab-content.active { display:block; }
.tab-content h3 { color:white; margin-top:0; }
.tab-content a { color: var(--bsw-orange); }

/* INTERACTIVE IMAGE STYLES */
.img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background-color: #eee;
}

.draggable-img {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    cursor: grab;
    user-select: none;
    pointer-events: auto;
}
.draggable-img:active { cursor: grabbing; }

/* INTERACTIVE TEXT STYLES */
.draggable-text {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 60; 
    /* Umbrüche erlauben! */
    white-space: nowrap; 
    transform-origin: 0 0; 
    text-align: left; /* Default alignment */
}
.draggable-text:active {
    cursor: grabbing;
    outline: 1px dashed rgba(255,255,255,0.5);
}

/* NEU: Hervorhebung für aktive (gegriffene) Elemente */
.active-element {
    outline: 3px dashed var(--bsw-orange);
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    z-index: 9999 !important; /* Immer ganz oben wenn angefasst */
}

/* Optional: Animation für das Outline */
@keyframes dash {
  to { stroke-dashoffset: -10; }
}
