/*!
 * ============================================================================
 * URHEBERRECHTSHINWEIS / COPYRIGHT NOTICE
 * ============================================================================
 * * @copyright   © 2024 connectum. Alle Rechte vorbehalten.
 *   @author      Stefan Brauch
 *   @version     1.0
 * * WARNUNG:
 *   Dieses Skript, einschließlich aller Algorithmen, Berechnungslogiken und 
 *   3D-Implementierungen, ist urheberrechtlich geschützt und geistiges Eigentum 
 *   des oben genannten Autors.
 * * Es handelt sich um proprietäre Software und NICHT um Open-Source-Software.
 * * UNTERSAGT IST:
 *   1. Das Kopieren, Vervielfältigen oder Verbreiten dieses Codes (ganz oder teilweise).
 *   2. Die Nutzung des Codes in eigenen Projekten oder auf fremden Webseiten 
 *      ohne ausdrückliche schriftliche Genehmigung.
 *   3. Das "Reverse Engineering" oder die Bearbeitung des Codes.
 *   4. Das Entfernen oder Verändern dieses Urheberrechtshinweises.
 * * Zuwiderhandlungen stellen eine Verletzung des Urheberrechts dar und werden 
 * zivil- und strafrechtlich verfolgt.
 * * ============================================================================
 */

:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    /* NEUE ORANGE TÖNE */
    --primary: #EC460C; 
    --primary-hover: #FF6329;
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --input-bg: #2c2c2c;
    --border-color: #333333;
    --warning-color: #cc0000; 
}

* { box-sizing: border-box; }

/* Verhindert das Reinzoomen bei schnellem Tippen */
button, input, select, textarea, .ctrl-btn, .step-circle, .stepper-item {
     touch-action: manipulation;
}

body { 
    margin: 0; 
    overflow: hidden; 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    display: flex; 
    
    /* FIX: Erst Fallback, dann dynamische Höhe für iOS Adressleisten */
    height: 100vh; 
    height: 100dvh; 
    
    background-color: #000; 
    color: var(--text-main);
    -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
    -webkit-touch-callout: none;
}

@media print { html, body { display: none !important; } }

/* MOBILE LANDSCAPE ENFORCER */
#orientation-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #121212; z-index: 99999;
    display: none; /* Standardmäßig ausgeblendet */
    flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 20px;
}

.phone-rotate-icon {
    width: 80px; height: 80px; fill: #666;
    animation: rotate-phone 2s infinite ease-in-out;
    margin-bottom: 20px;
}

@keyframes rotate-phone {
    0% { transform: rotate(0deg); opacity: 0.5; }
    25% { opacity: 1; }
    50% { transform: rotate(-90deg); opacity: 1; }
    100% { transform: rotate(-90deg); opacity: 0.5; }
}

/* Regel: Nur auf kleinen Bildschirmen (Handys) UND im Hochformat anzeigen */
@media only screen and (max-width: 900px) and (orientation: portrait) {
    #orientation-overlay { display: flex; }
    body { overflow: hidden; }
}

#sidebar {
    width: 380px; min-width: 380px; 
    background: var(--bg-panel); 
    
    /* FIX: Unten kein Padding, damit der Footer bis zum Rand kann */
    padding: 30px 30px 0 30px;
    
    box-shadow: 5px 0 20px rgba(0,0,0,0.5); 
    z-index: 10;
    display: flex; flex-direction: column; 
    justify-content: space-between; 
    border-right: 1px solid #333; 
    
    /* FIX: Sidebar soll volle Höhe des flex-Elternteils (body) nutzen */
    height: 100%;
}

.sidebar-content {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 20px;
}

/* --- FOOTER CSS KORRIGIERT --- */
#sidebar-footer {
    border-top: 1px solid #333;
    margin-top: auto; 
    text-align: left; 
    background: var(--bg-panel);

    /* FIX: Symmetrisches Padding für vertikale Zentrierung */
    padding-top: 20px;
    padding-bottom: 20px; 
    
    /* FIX: Addiert den Abstand des Home-Balkens (iOS Safe Area) dynamisch dazu */
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.footer-branding-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

.footer-logo-img {
    height: 18px; 
    width: auto;
    display: block;
    border: none;
}

.footer-subline {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: -3px; 
}

.text-by {
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.7rem;
    color: #888; 
}

.text-connectum {
    font-family: 'Haettenschweiler', 'Impact', sans-serif;
    font-size: 1.0rem;
    letter-spacing: 0.8px;
}

.c-orange { color: var(--primary); }
.c-grey { color: #B4B6B6; } 

.footer-copyright {
    color: #B4B6B6; 
    font-size: 0.55rem;
    font-family: 'Segoe UI', sans-serif;
}
/* --- ENDE FOOTER CSS --- */

.logo-text { font-family: 'Haettenschweiler', 'Impact', sans-serif; font-weight: bold; }
.logo-orange { fill: var(--primary); } 
.logo-grey { fill: #808080; }     

/* Angepasste Klassen für Logo Header */
.brand-header { 
    display: flex;            
    align-items: flex-end;    
    gap: 10px;                
    margin-bottom: 25px; 
}

/* Der Link um das Logo bestimmt die Breite */
.brand-logo-link { 
    width: 45%;       /* Nimmt 45% der Sidebar-Breite ein */
    display: block;
    text-decoration: none;
    cursor: pointer;
    border: none;
    flex-shrink: 0;   /* Verhindert Zusammenfallen */
}

/* Das Bild füllt den Link aus */
.brand-logo { 
    width: 100%;      /* 100% vom Eltern-Link */
    height: auto; 
    display: block; 
    margin-bottom: 0;        
}

.brand-claim { 
    color: var(--text-muted); 
    font-size: 0.7rem;        
    margin-bottom: 0px;       
    font-family: 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
    line-height: 1.2;
    flex: 1;                  
}

p.subtitle { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 30px; line-height: 1.4; }

/* STEPPER MIT TEXT */
.stepper-container {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 35px; position: relative;
    padding: 0 5px; 
}
.stepper-item {
    display: flex; flex-direction: column; align-items: center;
    position: relative; z-index: 2; cursor: pointer; 
    width: 46px; 
}
.step-circle {
    width: 26px; height: 26px; border-radius: 50%;
    background: #333; color: #666;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 0.8rem;
    transition: all 0.3s; margin-bottom: 6px;
}

.step-label {
    position: absolute;
    top: 32px; 
    left: 50%;
    transform: translateX(-50%); 
    font-size: 0.6rem; 
    color: #555; 
    text-transform: uppercase; 
    font-weight: 600;
    transition: all 0.3s; 
    text-align: center; 
    letter-spacing: 0px; 
    white-space: nowrap; 
}

.stepper-item.active .step-circle { background: var(--primary); color: white; box-shadow: 0 0 10px rgba(236, 70, 12, 0.6); }
.stepper-item.active .step-label { color: var(--primary); }
.stepper-item.completed .step-circle { background: var(--primary); color: white; }
.stepper-item.completed .step-label { color: #ccc; }

.stepper-item:hover .step-circle { background: #444; color: #999; }
.stepper-item.active:hover .step-circle { background: var(--primary); color: white; }
.stepper-item.completed:hover .step-circle { background: var(--primary); color: white; }

.stepper-item.warning .step-circle {
    background: var(--warning-color) !important;
    color: white !important;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.6);
    animation: pulse-warning 2s infinite;
}
.stepper-item.warning .step-label {
    color: var(--warning-color) !important;
}
@keyframes pulse-warning {
    0% { box-shadow: 0 0 0 0 rgba(255, 51, 51, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(255, 51, 51, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 51, 51, 0); }
}

.step-line {
    position: absolute; top: 13px; 
    left: 0; width: 100%; height: 2px;
    background: #333; z-index: 1; transform: translateY(-50%);
}

.wizard-step { display: none; animation: fadeIn 0.4s ease-in-out; }
.wizard-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.input-group { margin-bottom: 25px; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-muted); font-size: 0.85rem; letter-spacing: 0.5px; }

input[type="number"], input[type="text"], input[type="email"], select, textarea {
    width: 100%; padding: 12px 15px; 
    background: var(--input-bg); border: 1px solid var(--border-color); 
    border-radius: 6px; font-size: 1rem; color: white;
    transition: 0.2s; 
    
    appearance: none;         /* Standard Eigenschaft (NEU) */
    -webkit-appearance: none; /* Fallback für sehr alte iOS Versionen (kann oft weg, stört aber nicht) */
    
    font-family: inherit;
}
textarea { resize: vertical; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(236, 70, 12, 0.2); }

/* Remove native spin buttons */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { 
    -webkit-appearance: none; /* Hier ist die Warnung OKAY, das ist nötig für Chrome/Safari */
    margin: 0; 
}

input[type=number] { 
    appearance: textfield;      /* Standard-Weg */
    -moz-appearance: textfield; /* Firefox-spezifischer Weg */
}

.btn-row { display: flex; gap: 10px; margin-top: 30px; }

button { font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

.btn-next { 
    width: 100%; padding: 14px; 
    background: linear-gradient(135deg, #FF6329 0%, #EC460C 100%);
    color: white; border: none; border-radius: 6px; 
    font-size: 1rem; font-weight: bold; cursor: pointer; 
    transition: 0.2s; text-transform: uppercase; letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(236, 70, 12, 0.3);
}
.btn-next:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(236, 70, 12, 0.4); }

.summary-box { 
    background: #252525; border: 1px solid #333; 
    padding: 15px; border-radius: 6px; margin-bottom: 25px; 
    color: #ccc; font-size: 0.9rem; line-height: 1.5;
}
.summary-box strong { color: var(--primary); }

.warning-msg {
    color: #ff6b6b; background: rgba(255, 107, 107, 0.1); border: 1px solid #ff6b6b; 
    padding: 10px; border-radius: 6px; margin-top: 10px; font-size: 0.85rem; 
    display: none; font-weight: bold;
}

#success-area { display: none; text-align: center; animation: fadeIn 0.5s; margin-top: 20px;}
.success-box { padding: 20px; background: rgba(40, 167, 69, 0.1); border-radius: 8px; color: #4cd137; border: 1px solid #2e7d32; margin-bottom: 20px;}

.btn-restart { width: 100%; padding: 12px; background: #333; color: white; border: 1px solid #555; border-radius: 6px; font-weight: bold; cursor: pointer; margin-top: 0px; font-size: 1rem;}
.btn-mail-manual { display: block; width: 100%; padding: 12px; background: var(--primary); color: white; text-decoration: none; border-radius: 6px; margin-bottom: 10px; font-weight: bold; font-size: 1rem; text-align: center;}
.btn-copy { width: 100%; padding: 12px; background: #444; color: white; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; margin-bottom: 10px; font-size: 1rem;}

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 1000;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}
.modal-box {
    background: var(--bg-panel); 
    width: 90%; 
    max-width: 650px; 
    padding: 30px; 
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); 
    border: 1px solid #333;
    animation: popIn 0.3s ease-out;
    max-height: 90vh; 
    overflow-y: auto; 
}
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Flex-Zeile für 2 Spalten */
.form-row {
    display: flex;
    gap: 20px;
}
.form-row .input-group {
    flex: 1; /* Beide Felder gleich breit */
    margin-bottom: 15px;
}

/* Handy Anpassung: Untereinander */
@media (max-width: 650px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-row .input-group {
        margin-bottom: 20px;
    }
}

.modal-header { font-size: 1.2rem; font-weight: bold; margin-bottom: 20px; color: white; border-bottom: 1px solid #333; padding-bottom: 15px; }
.btn-send { flex: 1; background: var(--primary); color: white; padding: 12px; border:none; border-radius:4px; font-weight:bold; cursor:pointer; }
.btn-cancel { flex: 1; background: #333; color: #ccc; padding: 12px; border:none; border-radius:4px; font-weight:bold; cursor:pointer; }

#canvas-container { flex-grow: 1; background: #000; position: relative; overflow: hidden; }

#canvas-disclaimer {
    position: absolute;
    bottom: 10px;
    right: 15px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    pointer-events: none;
    z-index: 50;
    text-align: right;
    max-width: 300px;
}

small { color: #666; font-size: 0.8rem; display: block; margin-top: 5px; }

/* Buttons Styles */
#view-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column; 
    gap: 8px;
    z-index: 100;
}
.view-btn {
    width: 55px;
    height: 40px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.view-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateX(-2px); 
}
.view-btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 65px; 
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    border: 1px solid #444;
}

/* Controls für Plus/Minus */
.input-dim-wrapper { display: flex; align-items: center; gap: 8px; }
.ctrl-btn {
    display: flex; width: 44px; height: 44px; background: #333; color: white;
    border: 1px solid #555; border-radius: 6px; font-size: 1.2rem; font-weight: bold;
    cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; user-select: none;
}
.ctrl-btn:active { background: var(--primary); border-color: var(--primary); }
input[type="number"] { text-align: center; }