/**
 * 🔥 STUFFLE RETOURENPORTAL CSS - BRONKO CLEAN REWRITE 🔥
 * Komplett neu geschrieben - ZERO Technical Debt
 * Mobile-First, Performance-Optimiert, Pixel-Perfect
 */

/* ========================================
   1. CSS RESET & BASE
   ======================================== */

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

:root {
    /* Brand Colors */
    --primary: #E6596E;
    --primary-hover: #d14458;
    --primary-light: rgba(230, 89, 110, 0.1);
    --primary-focus: rgba(230, 89, 110, 0.15);
    
    /* Neutrals */
    --dark: #1a1a1a;
    --gray-900: #1F2937;
    --gray-700: #374151;
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;
    --gray-100: #F3F4F6;
    --white: #FFFFFF;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-focus: 0 0 0 4px var(--primary-focus);
    
    /* Layout */
    --header-height: 56px;
    --footer-height: 60px;
    --max-width: 600px;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dark);
    background: var(--gray-100);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   2. HEADER - FIXED TOP
   ======================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.header-content {
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-flag {
    font-size: 1.25rem;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 150ms ease, transform 150ms ease;
    cursor: pointer;
    padding: 0.25rem;
}

.lang-flag.active,
.lang-flag:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* ========================================
   3. MAIN CONTENT - FIXED SCROLLABLE
   ======================================== */

.main {
    position: fixed;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* WICHTIG: Main hat KEIN seitliches Padding aber bottom padding für Space! */
    padding-bottom: 1.5rem; /* Space zum Footer */
}

/* ========================================
   4. PROGRESS DOTS - STICKY INSIDE MAIN
   ======================================== */

.progress-dots {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--gray-100);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: all 250ms ease;
    cursor: pointer;
}

.dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

.dot:hover:not(.active) {
    background: var(--gray-500);
    transform: scale(1.2);
}

/* ========================================
   5. SLIDE CONTAINER - MIT PADDING
   ======================================== */

.slide-container {
    /* DAS HIER hat das Padding, nicht .main! */
    padding: 0.5rem 1rem 1.5rem 1rem !important; /* Extra bottom padding */
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

/* ========================================
   6. SLIDES SYSTEM
   ======================================== */

.slide {
    display: none;
    opacity: 0;
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: opacity 250ms ease;
}

.slide.active {
    display: block;
    opacity: 1;
    animation: slideIn 250ms ease;
}

/* Contact Slide - Minimal Padding! */
.slide[data-slide="contact"] {
    padding: 1rem !important;
}

.slide[data-slide="contact"] h3:first-child {
    margin-top: 0 !important;
    margin-bottom: 0.75rem !important;
}

.slide[data-slide="contact"] h3:nth-child(3) {
    margin-top: 1rem !important;
    margin-bottom: 0.75rem !important;
}

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

/* ========================================
   7. TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

/* ========================================
   8. FORM ELEMENTS
   ======================================== */

.input-group {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--gray-700);
}

.input-field {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    transition: all 150ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.input-field:hover {
    border-color: var(--gray-300);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.input-field:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
    opacity: 0.6;
}

.input-field::placeholder {
    color: var(--gray-400);
}

/* SKU Input Special */
.sku-input-wrapper {
    position: relative;
}

.sku-prefix {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--gray-500);
    font-size: 1rem;
    pointer-events: none;
}

.sku-input {
    padding-left: 3rem !important;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-family: var(--font-mono);
}

/* Textarea */
textarea.input-field {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* ========================================
   9. BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-ghost:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

/* ========================================
   10. ITEMS LIST (nicht Grid!)
   ======================================== */

.items-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin: 1rem 0;
}

/* Custom Scrollbar */
.items-grid::-webkit-scrollbar {
    width: 6px;
}

.items-grid::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.items-grid::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.items-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.item-card {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    transition: all 150ms ease;
}

.item-card:hover {
    border-color: var(--primary);
    background: rgba(230, 89, 110, 0.05);
    transform: translateX(4px);
}

.item-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(230, 89, 110, 0.05);
}

.item-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    pointer-events: none;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.item-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--gray-100);
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-brand {
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.3;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.item-details {
    font-size: 0.75rem;
    color: var(--gray-500);
    line-height: 1.4;
}

/* ========================================
   11. REASON GRID
   ======================================== */

.reason-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.reason-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    cursor: pointer;
    transition: all 150ms ease;
    text-align: center;
}

.reason-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.reason-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.reason-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.reason-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

/* ========================================
   12. ADDRESS SUGGESTIONS
   ======================================== */

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
}

.suggestion-item {
    padding: 0.875rem;
    cursor: pointer;
    transition: background 150ms ease;
    border-bottom: 1px solid var(--gray-100);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--gray-100);
}

.suggestion-title {
    font-weight: 500;
    color: var(--dark);
    font-size: 0.9375rem;
}

.suggestion-address {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ========================================
   13. FOOTER - FIXED BOTTOM
   ======================================== */

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    height: var(--footer-height);
    background: var(--white);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 150ms ease;
}

.footer-links a:hover {
    color: var(--dark);
}

/* ========================================
   14. UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* ========================================
   15. LOADING SPINNER
   ======================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   16. ALERT MESSAGES
   ======================================== */

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.alert-info {
    background: var(--primary-light);
    color: var(--dark);
    border: 1px solid var(--primary);
}

.alert-success {
    background: rgba(72, 187, 120, 0.1);
    color: var(--dark);
    border: 1px solid #48BB78;
}

.alert-error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--dark);
    border: 1px solid #F56565;
}

/* ========================================
   17. PHOTO UPLOAD
   ======================================== */

.photo-upload {
    border: 2px dashed var(--gray-300);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 150ms ease;
    margin-top: 1rem;
}

.photo-upload:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.photo-upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

#photoPreview {
    margin-top: 1rem;
}

#previewContainer {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--gray-200);
}

/* ========================================
   18. MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 640px) {
    /* Kleinere Schrift auf Mobile */
    html {
        font-size: 15px;
    }
    
    /* Progress Dots enger */
    .progress-dots {
        padding: 0.5rem 1rem !important;
    }
    
    /* Slide Container enger ABER mehr bottom space */
    .slide-container {
        padding: 0.25rem 0.75rem 2rem 0.75rem !important; /* 2rem bottom! */
    }
    
    /* Slides generell kleiner */
    .slide {
        padding: 1rem;
    }
    
    /* Contact Slide EXTRA eng */
    .slide[data-slide="contact"] {
        padding: 0.75rem !important;
    }
    
    /* Reason Grid einzeilig */
    .reason-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* ========================================
   19. DESKTOP OPTIMIZATIONS
   ======================================== */

@media (min-width: 768px) {
    /* Zentrierter Container */
    .main {
        left: 50%;
        transform: translateX(-50%);
        max-width: var(--max-width);
    }
    
    /* Größere Slides */
    .slide {
        padding: 2rem;
    }
}

/* ========================================
   20. iOS SAFE AREAS
   ======================================== */

@supports (-webkit-touch-callout: none) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--header-height) + env(safe-area-inset-top));
    }
    
    .main {
        top: calc(var(--header-height) + env(safe-area-inset-top));
        bottom: calc(var(--footer-height) + env(safe-area-inset-bottom));
    }
}

/* ========================================
   21. PRINT STYLES
   ======================================== */

@media print {
    .header,
    .footer,
    .progress-dots,
    .btn {
        display: none !important;
    }
    
    .main {
        position: static;
        overflow: visible;
    }
    
    .slide {
        page-break-inside: avoid;
    }
}

/* ========================================
   22. DARK MODE SUPPORT (für später)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Aktuell nicht aktiv, aber vorbereitet */
}

/**
 * 🎯 ENDE BRONKO CLEAN REWRITE
 * Keine Konflikte, keine redundanten Fixes, pure Performance
 */