/* AI Changing Room - Complete CSS - Mit Top Navigation */

@import url('https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap');

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

body {
    font-family: 'PT Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 50%, #2f2f2f 100%);
    min-height: 100vh;
    color: white;
    padding: 0;
    margin: 0;
    line-height: 1.6;
    
    /* AGGRESSIVE iOS Safari Fixes */
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
}

/* MAIN SCROLL CONTAINER */
.main-scroll-container {
    position: absolute;
    top: 60px; /* Navigation Höhe */
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: 0; /* KEIN EXTRA PADDING */
    
    /* WICHTIG: Background für Scroll Container */
    background: linear-gradient(135deg, #1a1a1a 0%, #252525 50%, #2f2f2f 100%);
    color: white;
}

/* Top Navigation - AGGRESSIV FIXED */
.bottom-nav {
    /* ABSOLUTE FIXIERUNG */
    position: absolute !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    
    /* Z-Index maximieren */
    z-index: 2147483647 !important;
    
    /* FIXED HEIGHT */
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    
    /* Visual Styling */
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 2px solid #d4c4a0;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.9);
    
    /* AGGRESSIVE iOS Safari Fixes */
    -webkit-transform: translate3d(0, 0, 0) !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    will-change: transform !important;
    
    /* Safe Area für iPhone */
    padding-top: env(safe-area-inset-top, 0);
    
    /* Prevent scrolling interference */
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    
    /* ZUSÄTZLICHE LAYER FIXES */
    contain: layout style !important;
    isolation: isolate !important;
    -webkit-transform-style: preserve-3d !important;
    transform-style: preserve-3d !important;
}

/* Für iOS Safari - zusätzliche Stabilisierung - VERSTÄRKT */
@supports (-webkit-touch-callout: none) {
    .bottom-nav {
        position: fixed !important;
        top: 0 !important;
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        
        /* ZUSÄTZLICHE iOS FIXES */
        -webkit-position: fixed !important;
        isolation: isolate !important;
        contain: strict !important;
        
        /* WICHTIG: Viewport Units für iOS */
        width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        
        /* Safe Area Handling */
        padding-top: env(safe-area-inset-top, 0px) !important;
        height: calc(60px + env(safe-area-inset-top, 0px)) !important;
        min-height: 60px !important;
        
        /* Scroll Behavior */
        -webkit-overflow-scrolling: auto !important;
        overflow: visible !important;
        
        /* Layer Promotion */
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
        will-change: transform !important;
        
        /* Background und Border */
        background: rgba(0, 0, 0, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 2px solid #d4c4a0 !important;
    }
    
    /* Container für iOS anpassen */
    .container {
        padding-top: calc(62px + env(safe-area-inset-top, 0px) + 20px) !important;
        position: relative !important;
        z-index: 1 !important;
    }
}

.nav-container {
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    position: relative;
}

.nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    justify-content: center;
    border-right: 1px solid #d4c4a0;
    height: 100%;
    
    /* Touch Optimierungen */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item:last-child {
    border-right: none;
}

.nav-item:hover, 
.nav-item:active {
    background: rgba(79, 172, 254, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(79, 172, 254, 0.2);
    color: white;
}

.nav-item svg {
    opacity: 0.8;
    transition: opacity 0.3s ease;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.nav-item:hover svg,
.nav-item.active svg {
    opacity: 1;
}

.container {
    margin: 0 auto;
    max-width: 420px;
    position: relative;
    z-index: 1;
    /* MINIMALES PADDING - nur 10px oben */
    padding: 10px 20px 40px 20px;
}

/* Header */
.header {
    text-align: center;
    margin: 0 0 40px 0; /* 40PX ABSTAND ZU STEPS */
    padding: 0; /* KEIN PADDING */
}

.user-info {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 14px;
}

.user-limit {
    background: rgba(79, 172, 254, 0.1);
    border: 1px solid rgba(79, 172, 254, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.9);
}

.logout-btn {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #d4c4a0;
    text-shadow: 0 2px 10px rgba(212, 196, 160, 0.3);
    margin-bottom: 8px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Main Content Area */
.main-content {
    position: relative;
    min-height: 500px;
}

.content-section {
    display: none;
}

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

/* Gallery Section */
.gallery-section {
    min-height: 70vh;
    padding-bottom: 40px;
}

.gallery-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.gallery-header h2 {
    font-size: 2rem;
    color: #d4c4a0;
    margin-bottom: 10px;
}

.gallery-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 0.6;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.gallery-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #00f2fe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.gallery-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Wizard System */
.wizard-wrapper {
    position: relative;
    min-height: 500px;
}

.step {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.step.active {
    display: block;
}

.step h3 {
    margin-bottom: 25px;
    font-size: 1.3rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Upload Buttons */
.upload-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 25px;
}

.btn {
    padding: 18px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'PT Sans', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn svg {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.btn:hover:not(:disabled) {
    background: rgba(79, 172, 254, 0.1);
    border-color: rgba(79, 172, 254, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.15);
}

.btn:hover:not(:disabled) svg {
    opacity: 1;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Preview */
.preview {
    display: none;
    margin: 20px 0;
    text-align: center;
    animation: fadeInUp 0.5s ease;
}

.preview.show {
    display: block;
}

.preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-remove {
    background: linear-gradient(45deg, rgba(255, 59, 48, 0.2), rgba(255, 69, 58, 0.2));
    border-color: rgba(255, 59, 48, 0.3);
    margin-top: 15px;
    padding: 10px 20px;
    font-size: 12px;
    gap: 0;
}

/* Upload Modal */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.upload-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.upload-modal-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    color: white;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.upload-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #00f2fe;
    border-radius: 50%;
    animation: uploadSpin 1s linear infinite;
    margin: 0 auto 25px;
}

@keyframes uploadSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.upload-modal h3 {
    margin-bottom: 15px;
    font-size: 1.4em;
    color: #d4c4a0;
}

.upload-modal p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 10px;
}

.upload-progress {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Gender Grid - EXAKT WIE GALLERY GRÖSSEN */
.gender-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.gender-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'PT Sans', sans-serif;
    padding: 0;
    position: relative;
    margin-bottom: 20px; /* WENIGER PLATZ FÜR TEXT */
}

.gender-btn .gender-image {
    width: 100%;
    aspect-ratio: 0.6;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.gender-btn .gender-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gender-btn .gender-name {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    bottom: -20px; /* NÄHER ZUM BILD */
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.gender-btn svg {
    opacity: 0.7;
    transition: opacity 0.3s ease;
    font-size: 32px;
}

.gender-btn:hover .gender-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.3);
}

.gender-btn:hover .gender-name {
    color: white;
}

.gender-btn:hover svg {
    opacity: 1;
}

.gender-btn.active .gender-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.4);
    background: rgba(79, 172, 254, 0.1);
}

.gender-btn.active .gender-name {
    color: white;
}

.gender-btn.active svg {
    opacity: 1;
}

/* Category Grid - EINFACHE STRUKTUR WIE GALLERY */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px; /* MEHR ABSTAND ZWISCHEN KARTEN */
    margin-bottom: 30px;
}

.category-card {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    text-align: center;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* WENIGER ABSTAND ZWISCHEN BILD UND TEXT */
    margin-bottom: 10px; /* MEHR ABSTAND NACH UNTEN */
}

.category-image {
    width: 100%;
    aspect-ratio: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

.category-placeholder {
    width: 80px;
    height: 80px;
    background: rgba(212, 196, 160, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-icon {
    font-size: 32px;
}

.category-title {
    font-weight: 600;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.category-card:hover .category-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.3);
}

.category-card:hover .category-title {
    color: white;
}

.category-card.active .category-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.4);
    background: rgba(79, 172, 254, 0.1);
}

.category-card.active .category-title {
    color: white;
}

/* Themes Grid - EINFACHE STRUKTUR WIE GALLERY */
.variants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px; /* MEHR ABSTAND ZWISCHEN KARTEN */
    margin-bottom: 25px;
    max-height: 500px;
    overflow-y: auto;
}

.theme-card {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    text-align: center;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* WENIGER ABSTAND ZWISCHEN BILD UND TEXT */
    margin-bottom: 10px; /* MEHR ABSTAND NACH UNTEN */
}

.theme-image {
    width: 100%;
    aspect-ratio: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.theme-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

.theme-placeholder {
    width: 80px;
    height: 80px;
    background: rgba(212, 196, 160, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon {
    font-size: 32px;
}

.theme-content {
    width: 100%;
    text-align: center;
}

.theme-title {
    font-weight: 600;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.theme-description {
    display: none; /* Prompt ausblenden */
}

.theme-card:hover .theme-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.3);
}

.theme-card:hover .theme-title {
    color: white;
}

.theme-card.selected .theme-image {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.4);
    background: rgba(79, 172, 254, 0.1);
}

.theme-card.selected .theme-title {
    color: white;
}

/* Step Navigation */
.step-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    gap: 15px;
}

.step-nav .btn {
    flex: 1;
    padding: 16px 20px;
    font-size: 14px;
    gap: 0;
    flex-direction: row;
}

/* Step 1, 2 - Weiter-Button verstecken da automatisch */
.step-1 .btn-next,
.step-2 .btn-next {
    display: none;
}

/* Step 4 - Weiter-Button verstecken da automatisch */
.step-4 .btn-next {
    display: none;
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-back:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-next {
    background: linear-gradient(45deg, rgba(79, 172, 254, 0.2), rgba(0, 242, 254, 0.2));
    border-color: rgba(79, 172, 254, 0.3);
}

.btn-next:hover:not(:disabled) {
    background: linear-gradient(45deg, rgba(79, 172, 254, 0.3), rgba(0, 242, 254, 0.3));
    border-color: rgba(79, 172, 254, 0.5);
}

.btn-generate {
    background: linear-gradient(45deg, rgba(0, 255, 136, 0.2), rgba(0, 204, 255, 0.2));
    border-color: rgba(0, 255, 136, 0.3);
    font-weight: 700;
}

.btn-generate:hover:not(:disabled) {
    background: linear-gradient(45deg, rgba(0, 255, 136, 0.3), rgba(0, 204, 255, 0.3));
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.2);
}

/* Error Display */
.error-display {
    display: none;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.error-display.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.error-content h4 {
    color: #ff3b30;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.error-content p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.4;
}

.btn-small {
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'PT Sans', sans-serif;
    font-weight: 600;
}

.btn-small:hover {
    background: rgba(255, 59, 48, 0.3);
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.loading.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #00f2fe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.loading p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
}

/* Results */
.result {
    display: none;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px 20px;
    margin: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.result.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.result h3 {
    margin-bottom: 20px;
    font-size: 1.5em;
}

.result-image {
    margin-bottom: 25px;
}

.result-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.result-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.result-actions .btn {
    flex: 1;
    min-width: 120px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3 {
    margin-bottom: 20px;
    text-align: center;
    color: white;
}

/* Templates Gallery Style - Templates Section */
.templates-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.templates-header h2 {
    font-size: 2rem;
    color: #d4c4a0;
    margin-bottom: 10px;
}

.templates-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

.templates-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.template-gallery-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
}

.template-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.3);
}

.template-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Templates Modal Content anpassen */
#templatesModal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 90%;
    padding: 20px;
}

#templatesModal .modal-content h3 {
    display: none; /* Alte H3 verstecken, wir haben jetzt templates-header */
}

/* Gallery Loading in Templates */
.templates-gallery-grid .gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.templates-gallery-grid .gallery-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #00f2fe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.templates-gallery-grid .gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.templates-gallery-grid .gallery-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Alte Templates Grid - für Fallback */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.template-item {
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    height: 120px;
    width: 100%;
}

.template-item:hover {
    border-color: rgba(79, 172, 254, 0.4);
    transform: scale(1.05);
}

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'PT Sans', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin: 0 auto;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Image Modal spezifische Styles */
#imageModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

#imageModal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

#imageModal .modal-content {
    padding: 0;
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#modalImage {
    width: auto;
    height: auto;
    max-height: 80vh;
    max-width: 95vw;
    object-fit: contain;
    display: block;
    border-radius: 15px;
    margin-bottom: 20px;
}

/* Modal Action Buttons */
.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'PT Sans', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.modal-download {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
}

.modal-download:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.4);
}

.modal-share {
    background: rgba(79, 172, 254, 0.1);
    border-color: rgba(79, 172, 254, 0.3);
}

.modal-share:hover {
    background: rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.4);
}

/* Schließen-Button für Image Modal - oben rechts FIXED */
#imageModal .modal-close {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#imageModal .modal-close:hover {
    background: rgba(255, 59, 48, 0.9);
    border-color: rgba(255, 59, 48, 0.8);
    transform: scale(1.1);
}

/* Mobile Anpassungen für Image Modal */
@media (max-width: 768px) {
    #modalImage {
        max-height: 70vh;
        max-width: 90vw;
    }
    
    .modal-actions {
        flex-direction: row;
        gap: 10px;
    }
    
    .modal-btn {
        flex: 1;
        min-width: 120px;
        padding: 15px 10px;
        font-size: 13px;
    }
    
    #imageModal .modal-close {
        top: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile-spezifische Anpassungen - KOMPLETT ÜBERARBEITET FÜR iPHONE */
@media (max-width: 768px) {
    /* BODY - FIXED CONTAINER */
    body {
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* MAIN SCROLL CONTAINER FÜR MOBILE */
    .main-scroll-container {
        position: absolute !important;
        top: calc(60px + env(safe-area-inset-top, 0)) !important; /* ZURÜCK ZU 60PX */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        height: calc(100vh - 60px - env(safe-area-inset-top, 0)) !important;
        height: calc(100dvh - 60px - env(safe-area-inset-top, 0)) !important;
        padding-top: 30px !important; /* PADDING STATT MARGIN */
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
        
        /* WICHTIG: Background für Mobile */
        background: linear-gradient(135deg, #1a1a1a 0%, #252525 50%, #2f2f2f 100%) !important;
        color: white !important;
    }
    
    /* NAVIGATION - ABSOLUTE FIXED */
    .bottom-nav {
        position: absolute !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        width: 100vw !important;
        z-index: 2147483647 !important;
        
        /* FIXED DIMENSIONS */
        height: calc(60px + env(safe-area-inset-top, 0)) !important;
        min-height: calc(60px + env(safe-area-inset-top, 0)) !important;
        max-height: calc(60px + env(safe-area-inset-top, 0)) !important;
        
        /* Safe Area */
        padding-top: env(safe-area-inset-top, 0) !important;
        
        /* LAYER FIXES */
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
        will-change: transform !important;
        
        /* VISUAL */
        background: rgba(0, 0, 0, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 2px solid #d4c4a0 !important;
        box-shadow: 0 3px 15px rgba(0, 0, 0, 0.9) !important;
        
        /* ISOLATION */
        contain: strict !important;
        isolation: isolate !important;
    }
    
    .nav-container {
        height: 60px !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .container {
        padding: 0 10px 20px 10px !important; /* KOMPLETT OHNE TOP PADDING */
        margin: 0 !important; /* KEIN MARGIN */
        max-width: 100%;
        width: 100%;
        position: relative;
    }
    
    .header {
        margin: 0 0 30px 0 !important; /* 30PX ABSTAND AUF MOBILE */
        padding: 0 !important; /* KEIN PADDING */
    }
    
    /* LOADING UND RESULT OBEN POSITIONIEREN */
    .loading, .result {
        position: absolute !important;
        top: 5px !important;
        left: 10px !important;
        right: 10px !important;
        margin: 0 !important;
        z-index: 1000 !important;
    }
    
    .result {
        max-height: calc(100vh - 100px) !important;
        max-height: calc(100dvh - 100px) !important;
        overflow-y: auto !important;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .upload-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .step-nav {
        flex-direction: column;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .variants-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .template-item {
        height: 100px;
    }
    
    /* Templates Gallery Grid auf Mobile */
    .templates-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-height: 50vh;
    }
    
    .templates-header h2 {
        font-size: 1.5rem;
    }
    
    #templatesModal .modal-content {
        width: 95%;
        padding: 15px;
    }
    
    /* Gender, Category, Theme Grid auf Mobile - GLEICHE GRÖSSE WIE GALLERY */
    .gender-grid, .category-grid, .variants-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Gallery Grid auf Mobile */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Navigation verstärkte Fixierung auf Mobile */
    .bottom-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        z-index: 999999 !important;
        
        /* Zusätzliche iOS Safari Fixes */
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
        will-change: transform !important;
        
        /* STÄRKERE MOBILE FIXES */
        -webkit-position: fixed !important;
        contain: strict !important;
        isolation: isolate !important;
        min-height: 60px !important;
        max-height: 70px !important;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .template-item {
        height: 130px;
    }
    
    .templates-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-grid, .variants-grid, .gender-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* iPad und größer */
@media (min-width: 769px) {
    .container {
        max-width: 70%;
        padding-top: calc(60px + env(safe-area-inset-top, 0) + 30px);
    }
    
    .upload-buttons {
        grid-template-columns: 1fr 1fr 1fr;
    }
    
    .templates-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .template-item {
        height: 140px;
    }
    
    .templates-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        max-height: 70vh;
    }
    
    .category-grid, .variants-grid, .gender-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Desktop - EXAKT WIE GALLERY: 5 SPALTEN */
@media (min-width: 1024px) {
    .container {
        max-width: 80%;
        padding-top: calc(60px + env(safe-area-inset-top, 0) + 40px);
    }
    
    .templates-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .template-item {
        height: 150px;
    }
    
    .templates-gallery-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    /* ALLE GRIDS HABEN 5 SPALTEN WIE GALLERY */
    .category-grid, .variants-grid, .gender-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    /* Upload Buttons größer auf Desktop */
    .upload-buttons {
        max-width: 600px;
        margin: 0 auto 25px;
    }
}

/* iOS Safari spezielle Viewport Unit Fixes - ERWEITERT */
@supports (-webkit-appearance: none) and (not (stroke-color: initial)) {
    /* iOS Safari Detection */
    .bottom-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: calc(60px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        
        /* VERSTÄRKTE iOS Safari Fixes */
        -webkit-position: fixed !important;
        contain: strict !important;
        isolation: isolate !important;
        
        /* Layer Promotion */
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
        will-change: transform !important;
        
        /* Scroll Fix */
        -webkit-overflow-scrolling: auto !important;
        overflow: hidden !important;
        
        /* Visual Styling */
        background: rgba(0, 0, 0, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 2px solid #d4c4a0 !important;
        box-shadow: 0 3px 15px rgba(0, 0, 0, 0.9) !important;
        
        /* Z-Index */
        z-index: 999999 !important;
    }
    
    .nav-container {
        height: 60px !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .nav-item {
        border-right: 1px solid #d4c4a0 !important;
    }
    
    .container {
        padding-top: calc(62px + env(safe-area-inset-top, 0px) + 20px) !important;
        position: relative !important;
        z-index: 1 !important;
        width: 100% !important;
        margin: 0 auto !important;
    }
}

/* ZUSÄTZLICHER iOS Safari Fix - WebKit spezifisch */
@supports (-webkit-touch-callout: none) and (-webkit-appearance: none) {
    .bottom-nav {
        /* Doppelte Sicherheit für iOS */
        position: -webkit-sticky !important;
        position: sticky !important;
        position: fixed !important;
        top: 0 !important;
        
        /* Transform Stack */
        -webkit-transform: translateZ(0) !important;
        -moz-transform: translateZ(0) !important;
        -ms-transform: translateZ(0) !important;
        -o-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        
        /* Composite Layer */
        will-change: transform, opacity !important;
        
        /* Safe Area */
        height: calc(60px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
    }
}

/* Fallback für sehr alte Browser ohne CSS Support */
@supports not (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .container {
            padding-top: 90px;
        }
        
        .bottom-nav {
            height: 70px;
            padding-top: 10px;
        }
    }
}