/* Cookie Banner Styling für Wombach.de
 * Version: 2.1 - Januar 2026
 * Responsive Design für alle Geräte
 * FIX: iOS Safari / iPad / Smartphone Kompatibilität
 */

/* ===== COOKIE BANNER (unten fixiert) ===== */
.cookie-banner {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 999999;  /* Erhöht für iOS */
    transition: bottom 0.5s ease-in-out;
    border-top: 3px solid #4a90e2;
    max-width: 965px;
    width: calc(100% - 40px);
    box-sizing: border-box;
    /* iOS Safari Fix - verhindert Rendering-Probleme */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.cookie-banner.show {
    bottom: 0;
}

/* iOS Safe Area für Geräte mit Home-Indicator (iPhone X+, neuere iPads) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .cookie-banner.show {
        bottom: env(safe-area-inset-bottom);
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

.cookie-content {
    max-width: 965px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    /* Flexbox Fix für ältere Safari Versionen */
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
}

.cookie-text {
    flex: 1;
    -webkit-flex: 1;
    line-height: 1.6;
    font-size: 14px;
}

.cookie-text strong {
    font-size: 16px;
    display: block;
    margin-bottom: 5px;
}

.privacy-link {
    color: #ffd700;
    text-decoration: underline;
    font-weight: bold;
}

.privacy-link:hover {
    color: #fff;
}

/* ===== BUTTONS ===== */
.cookie-buttons {
    display: flex;
    display: -webkit-flex;
    gap: 10px;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
}

/* Gap-Fallback für ältere Browser */
@supports not (gap: 10px) {
    .cookie-buttons > * {
        margin-left: 5px;
        margin-right: 5px;
    }
    .cookie-buttons > *:first-child {
        margin-left: 0;
    }
    .cookie-buttons > *:last-child {
        margin-right: 0;
    }
}

.cookie-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    /* Touch-Optimierung für Mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cookie-btn.accept {
    background: #28a745;
    color: white;
}

.cookie-btn.accept:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.cookie-btn.decline {
    background: #dc3545;
    color: white;
}

.cookie-btn.decline:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.cookie-btn.settings {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid white;
}

.cookie-btn.settings:hover {
    background: white;
    color: #1e3c72;
    transform: translateY(-2px);
}

/* ===== MODAL (Einstellungen) ===== */
.cookie-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000000;  /* Höher als Banner */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    /* iOS Fix */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.cookie-modal.show {
    display: flex;
    display: -webkit-flex;
    align-items: center;
    -webkit-align-items: center;
    justify-content: center;
    -webkit-justify-content: center;
    animation: fadeIn 0.3s ease;
    -webkit-animation: fadeIn 0.3s ease;
}

.cookie-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;  /* Smooth Scrolling auf iOS */
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
    -webkit-animation: slideUp 0.3s ease;
}

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

@-webkit-keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@-webkit-keyframes slideUp {
    from { 
        -webkit-transform: translateY(50px);
        opacity: 0;
    }
    to { 
        -webkit-transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.cookie-modal-header {
    display: flex;
    display: -webkit-flex;
    justify-content: space-between;
    -webkit-justify-content: space-between;
    align-items: center;
    -webkit-align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e9ecef;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 44px;  /* Größer für Touch */
    height: 44px;  /* Größer für Touch */
    display: flex;
    display: -webkit-flex;
    align-items: center;
    -webkit-align-items: center;
    justify-content: center;
    -webkit-justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.cookie-modal-close:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

/* Modal Body */
.cookie-modal-body {
    padding: 25px;
}

.cookie-option {
    margin-bottom: 20px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.cookie-option:hover {
    border-color: #4a90e2;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.cookie-option-header {
    display: flex;
    display: -webkit-flex;
    align-items: center;
    -webkit-align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.cookie-option-title {
    flex: 1;
    -webkit-flex: 1;
    display: flex;
    display: -webkit-flex;
    align-items: center;
    -webkit-align-items: center;
    gap: 10px;
}

.cookie-option-title strong {
    color: #1e3c72;
}

.cookie-badge {
    background: #28a745;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.cookie-description {
    color: #6c757d;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

/* Toggle Switch */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    -webkit-transition: 0.4s;
    border-radius: 26px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    -webkit-transition: 0.4s;
    border-radius: 50%;
}

.cookie-switch input:checked + .cookie-slider {
    background-color: #28a745;
}

.cookie-switch input:checked + .cookie-slider:before {
    transform: translateX(24px);
    -webkit-transform: translateX(24px);
}

.cookie-switch input:disabled + .cookie-slider {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Modal Footer */
.cookie-modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #e9ecef;
    display: flex;
    display: -webkit-flex;
    gap: 10px;
    justify-content: flex-end;
    -webkit-justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablets */
@media (max-width: 768px) {
    .cookie-banner {
        width: calc(100% - 20px);  /* Weniger Rand auf Tablets */
        padding: 15px;
    }
    
    .cookie-content {
        flex-direction: column;
        -webkit-flex-direction: column;
        text-align: center;
    }
    
    .cookie-buttons {
        width: 100%;
        flex-direction: column;
        -webkit-flex-direction: column;
    }
    
    .cookie-btn {
        width: 100%;
        padding: 14px 24px;  /* Größere Touch-Targets */
        min-height: 44px;
    }
    
    .cookie-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .cookie-modal-footer {
        flex-direction: column;
        -webkit-flex-direction: column;
    }
    
    .cookie-modal-footer .cookie-btn {
        width: 100%;
    }
}

/* Smartphones */
@media (max-width: 480px) {
    .cookie-banner {
        width: calc(100% - 10px);
        padding: 12px;
        left: 5px;
        right: 5px;
        margin: 0;
    }
    
    .cookie-text {
        font-size: 13px;
    }
    
    .cookie-text strong {
        font-size: 14px;
    }
    
    .cookie-btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 48px;  /* Apple HIG empfiehlt 44px minimum */
    }
    
    .cookie-modal-header h2 {
        font-size: 18px;
    }
    
    .cookie-option {
        padding: 12px;
    }
    
    .cookie-option-header {
        flex-wrap: wrap;
        -webkit-flex-wrap: wrap;
    }
}

/* Landscape Orientation auf Smartphones */
@media (max-width: 768px) and (orientation: landscape) {
    .cookie-banner {
        padding: 10px 15px;
    }
    
    .cookie-content {
        flex-direction: row;
        -webkit-flex-direction: row;
        text-align: left;
    }
    
    .cookie-buttons {
        flex-direction: row;
        -webkit-flex-direction: row;
        width: auto;
    }
    
    .cookie-btn {
        width: auto;
        padding: 10px 16px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .cookie-banner,
    .cookie-btn,
    .cookie-modal,
    .cookie-modal-content,
    .cookie-slider,
    .cookie-slider:before {
        transition: none !important;
        -webkit-transition: none !important;
        animation: none !important;
        -webkit-animation: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cookie-banner {
        border: 3px solid white;
    }
    
    .cookie-btn {
        border: 2px solid currentColor;
    }
}