:root {
    --bg: #000000;
    --sidebar-bg: #080808;
    --border: #1a1a1a;
    --input-bg: #111111;
    --text: #ffffff;
    --muted: #555555;
    --accent: #ffffff; /* Porsche-Style: Weiß als Akzent oder ein sehr spezifisches Blau */
    --accent-active: #3b82f6;
    --danger: #cc3300;
    --radius: 4px; /* Strengere Ecken für technischeren Look */
    --font: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    height: 100vh;
    height: 100dvh; /* Fix für mobile Browser-Leisten */
    font-family: var(--font);
    color: var(--text);
    overflow: hidden; /* Desktop: Hidden, Mobile: Auto (siehe unten) */
    overscroll-behavior: none; /* Verhindert Pull-to-Refresh Effekt */
    -webkit-font-smoothing: antialiased;
}

/* Layout Grid */
.configurator-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: 100dvh;
    overflow: hidden;
}

/* Sidebar */
.config-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    box-shadow: 5px 0 30px rgba(0,0,0,0.5);
    overflow: hidden;
}

.sidebar-header {
    padding: 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar-bg);
}

.admin-login-btn {
    color: var(--muted);
    opacity: 0.4;
    transition: all 0.2s;
    display: flex;
}

.admin-login-btn:hover {
    opacity: 1;
    color: var(--text);
}

.logo-small {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.sidebar-header h2 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text);
    margin: 0;
}

/* Progress Dots */
.step-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px 0 0 0;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    transition: all 0.3s;
}

.step-dot.active {
    background: var(--text);
    transform: scale(1.2);
}

.config-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
    min-height: 0;
}

/* Sections */
.config-section {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    display: none; /* Standardmäßig ausblenden */
    animation: fadeIn 0.4s ease;
}

.config-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 24px;
    font-weight: 700;
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
    color: #888;
    font-weight: 500;
}

.badge {
    background: #222;
    color: #888;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    margin-left: 10px;
}

.price-badge {
    display: inline-block;
    font-size: 10px;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 700;
}

input[type="text"], textarea, select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid #222;
    border-radius: 4px;
    padding: 12px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

input[type="text"]:focus, textarea:focus, select:focus {
    border-color: var(--accent-active);
    background: #161616;
}

/* Custom Color Picker (Native Feel) */
.custom-color-picker {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 12px 0;
    scrollbar-width: none; /* Firefox */
}

.custom-color-picker::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #333;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, border-color 0.2s;
}

.color-swatch.active {
    border-color: #fff;
    transform: scale(1.1);
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: #222;
    border-radius: 2px;
    outline: none;
    margin-top: 12px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg);
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
    padding: 10px;
    background: var(--input-bg);
    border-radius: 4px;
    border: 1px solid #222;
}

input[type="checkbox"] {
    accent-color: var(--accent-active);
    width: 16px;
    height: 16px;
}

/* Textarea Resize */
textarea {
    resize: vertical;
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: var(--text);
    color: #000;
    border: none;
    padding: 16px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #ccc;
    transform: translateY(-1px);
}

.btn-secondary {
    width: 100%;
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    padding: 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-footer {
    padding: 30px;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.price-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.price-value {
    font-weight: 700;
    color: var(--text);
    font-size: 18px;
}

/* Preview Stage */
.preview-stage {
    background: #000;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
    position: relative;
}

/* Vignette Effect */
.preview-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, #000 90%);
    pointer-events: none;
}

.preview-device-wrapper {
    /* Desktop: Dynamische Höhe statt fester Pixel für "No Scroll" */
    height: 85vh;
    width: auto;
    aspect-ratio: 9/19;
    max-height: 850px;
    transition: transform 0.3s ease;
    /* Phone Frame Simulation */
    border: 12px solid #1a1a1a;
    border-radius: 40px;
    padding: 10px;
    background: radial-gradient(1000px 600px at 10% 10%, rgba(124, 58, 237, 0.12), transparent),
                radial-gradient(800px 500px at 90% 90%, var(--accent, #333), var(--accent-2, #555));
    background-color: var(--bg, #000);
    box-shadow: 0 0 0 2px #333, 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
    z-index: 5;
}

/* Mobile Elements (Hidden on Desktop) */
.mobile-preview-fab { display: none; }

/* Close Button for Preview Overlay */
.close-preview-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: none; /* Desktop: Versteckt */
    align-items: center;
    justify-content: center;
}

/* Links List Styles */
.links-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.link-field {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--input-bg);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #222;
}

.link-field select,
.link-field input {
    border: none;
    background: transparent;
    padding: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.link-field select {
    flex-shrink: 0;
    width: 120px;
    border-right: 1px solid #333;
}

.link-field input {
    flex-grow: 1;
}

.link-field .link-title-custom {
    flex-basis: 40%;
}

.remove-link-btn {
    background: transparent;
    color: #666;
    border: none;
    width: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
}

.remove-link-btn:hover {
    color: var(--danger);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.modal-content {
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: fadeIn 0.2s ease;
}

/* Responsive */
@media (max-width: 900px) {
    body {
        overflow: hidden; /* Prevent body scroll, handle in containers */
        height: 100dvh;
        position: fixed; /* Prevent bounce */
        width: 100%;
    }

    .configurator-layout {
        display: flex;
        flex-direction: column;
        height: 100dvh; /* WICHTIG: Volle Höhe nutzen */
    }
    
    .config-sidebar {
        height: auto; /* Flex item */
        border-right: none;
        border-bottom: 1px solid var(--border);
        box-shadow: none;
        flex: 1; /* Take remaining space */
        overflow: hidden; /* Sidebar selbst scrollt nicht, nur Area */
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }

    .sidebar-header {
        padding: 15px 20px; /* Kompakterer Header */
        flex-shrink: 0;
    }

    .step-progress {
        padding: 10px 0;
        flex-shrink: 0;
    }

    .config-scroll-area {
        padding: 10px 20px; /* Weniger Padding für mehr Inhalt */
        overflow-y: auto; /* HIER scrollen wir */
        flex: 1;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px; /* Platz für Floating Button */
    }

    /* Kompaktere Inputs für Mobile */
    .input-group {
        margin-bottom: 12px;
    }
    
    .input-group label {
        margin-bottom: 4px;
        font-size: 11px;
    }
    
    input[type="text"], textarea, select {
        padding: 10px;
        font-size: 14px; /* Verhindert Auto-Zoom auf iOS */
    }
    
    .section-title {
        margin-bottom: 15px;
    }

    .preview-stage {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        z-index: 200;
        transform: translateY(100%); /* Standardmäßig versteckt */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #000;
    }

    .preview-stage.active {
        transform: translateY(0);
    }

    .close-preview-btn {
        display: flex; /* Mobile: Anzeigen */
        top: 15px;
        right: 15px;
    }

    .preview-device-wrapper {
        transform: none;
        transform-origin: center center;
        height: 100%;
        width: 100%;
        aspect-ratio: auto;
        border-width: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    
    /* Preview im Fullscreen Modus anpassen */
    #preview {
        padding-top: 60px; /* Platz für Close Button */
    }

    .sidebar-footer {
        position: relative; /* Im Flex-Flow bleiben */
        z-index: 30;
        padding: 15px 20px;
        background: rgba(8,8,8,0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid #222;
        flex-shrink: 0;
        flex-direction: row; /* Buttons nebeneinander */
        align-items: center;
        padding-bottom: max(15px, env(safe-area-inset-bottom)); /* iPhone Home Bar */
    }

    .price-info {
        display: none; /* Preis im Footer ausblenden, Platz sparen */
    }

    /* Floating Action Button für Vorschau */
    .mobile-preview-fab {
        display: flex;
        position: fixed;
        bottom: 100px; /* Über dem Footer */
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--text);
        color: #000;
        border: none;
        font-size: 24px;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        z-index: 90;
        cursor: pointer;
        transition: transform 0.2s;
    }

    .mobile-preview-fab:active {
        transform: scale(0.95);
    }
}

/* --- PREVIEW CARD STYLES --- */
/* Styles für den Inhalt im Handy-Rahmen */

#preview {
    width: 100%;
    min-height: 100%;
    padding: 40px 20px;
    box-sizing: border-box;
    background: var(--card, rgba(0,0,0,0.5));
    color: var(--text, #fff);
    font-family: var(--font, sans-serif);
    text-align: center;
    backdrop-filter: blur(var(--blur, 20px));
    -webkit-backdrop-filter: blur(var(--blur, 20px));
}

#preview .profile {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#preview .avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 16px;
    border: var(--border-w, 2px) solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, var(--accent, #333), var(--accent-2, #555));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0, var(--shadow-o, 0.3));
}

#preview .avatar img { width: 100%; height: 100%; object-fit: cover; }

#preview .name {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text, #fff);
    line-height: 1.2;
}

#preview .verified-icon { width: 20px; height: 20px; display: inline-block; }

#preview .handle { font-size: 14px; color: var(--muted, #888); margin-top: 4px; }
#preview .bio { font-size: 14px; color: var(--muted, #888); margin-top: 12px; line-height: 1.5; }

#preview .links { display: flex; flex-direction: column; gap: 14px; width: 100%; margin-top: 32px; }

#preview .preview-btn {
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--radius, 18px);
    background: var(--accent, #333);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    display: block;
    border: var(--border-w, 1px) solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0, var(--shadow-o, 0.15));
}

#preview .footer { margin-top: 40px; font-size: 12px; color: var(--muted, #666); opacity: 0.8; }
#preview .footerlink { color: inherit; text-decoration: none; font-weight: 600; }

/* --- CHECKOUT VIEW --- */
.checkout-layout {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 300;
    overflow-y: auto;
    padding: 40px 20px;
    animation: fadeIn 0.3s ease;
}

.checkout-container {
    max-width: 1000px;
    margin: 0 auto;
}

.checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.checkout-header h2 {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

.btn-text:hover { color: var(--text); }

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 60px;
}

.checkout-details h3, .order-card h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 20px;
    font-weight: 700;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.summary-item {
    background: var(--input-bg);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-label { font-weight: 600; font-size: 14px; color: #ccc; }
.summary-value { color: #fff; font-size: 14px; }

.order-card {
    background: var(--sidebar-bg);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.pricing-list { margin-bottom: 20px; }
.pricing-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: #ccc;
}

.total-divider { height: 1px; background: #333; margin: 20px 0; }

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
}

.btn-checkout { background: #fff; color: #000; }
.btn-checkout:hover { background: #ddd; }
.checkout-note { font-size: 11px; color: #666; text-align: center; margin-top: 15px; }

@media(max-width: 900px) {
    .checkout-grid { grid-template-columns: 1fr; gap: 40px; }
    .checkout-header { flex-direction: column-reverse; gap: 20px; align-items: flex-start; }
}