/* =========================================================
   BSW QR-Code Generator – Stylesheet
   Konventionen: siehe AGENTS.md
   ========================================================= */

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

: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;
}

*, *::before, *::after { box-sizing: border-box; }

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;
}

/* ---- Loading Overlay ---- */
#loadingOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
    font-size: 1.1rem;
}
#loadingOverlay.active { display: flex; }

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

.control-group {
    border-bottom: 1px solid var(--border-col);
    padding: 14px 0;
}
.control-group:last-of-type { border-bottom: none; }

.control-group > label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    margin-bottom: 8px;
}

/* ---- Form Inputs ---- */
input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-col);
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 6px;
}
input[type="text"]:focus,
select:focus { outline: none; border-color: var(--bsw-orange); }

input[type="range"] {
    width: 100%;
    accent-color: var(--bsw-orange);
    cursor: pointer;
}

input[type="color"] {
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border-col);
    padding: 0;
    width: 36px;
    height: 32px;
}

.color-text-input {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin-bottom: 0;
}

/* ---- Toggle Switch ---- */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    inset: 0;
    background: #444;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}
.slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
input:checked + .slider { background: var(--bsw-orange); }
input:checked + .slider::before { transform: translateX(18px); }

/* ---- Pill Select ---- */
.pill-select.mini {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.pill {
    background: var(--input-bg);
    border: 1px solid var(--border-col);
    color: #bbb;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.pill:hover { border-color: var(--bsw-orange); color: white; }
.pill.active { background: var(--bsw-orange); border-color: var(--bsw-orange); color: white; font-weight: bold; }

/* ---- Buttons ---- */
.btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}
.btn-primary {
    background: linear-gradient(90deg, var(--bsw-pink), var(--bsw-orange));
    color: white;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-secondary {
    background: var(--input-bg);
    border: 1px solid var(--border-col);
    color: var(--text-main);
}
.btn-secondary:hover { border-color: #888; background: #333; }

/* ---- Logo Grid ---- */
.logo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.logo-thumb {
    width: 58px;
    height: 42px;
    object-fit: contain;
    background: white;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 4px;
    transition: border-color 0.2s;
}
.logo-thumb:hover { border-color: var(--bsw-orange); }
.logo-thumb.selected { border-color: var(--bsw-pink); box-shadow: 0 0 0 1px var(--bsw-pink); }

/* ---- Hint Text ---- */
.hint-text {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}
.hint-text.success { color: #4caf50; }
.hint-text.error   { color: #e53935; }

/* ---- Main Stage ---- */
.main-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-dark);
    padding: 30px;
}

#previewWrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ---- Placeholder ---- */
#qrPlaceholder {
    width: 320px;
    height: 320px;
    border: 2px dashed var(--border-col);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #555;
    gap: 12px;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}
.placeholder-icon { font-size: 64px; }

/* ---- QR Canvas ---- */
#qrCanvas {
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    max-width: min(90vw, 600px);
    max-height: min(80vh, 600px);
    image-rendering: pixelated;
}

/* ---- Meta Info ---- */
#qrMeta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}
#qrMeta span {
    background: var(--panel-bg);
    border: 1px solid var(--border-col);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #aaa;
}
.meta-url {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--bsw-orange) !important;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    body { flex-direction: column; height: auto; overflow: auto; }
    .sidebar { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border-col); }
    .main-stage { padding: 20px; }
}
