/**
 * Smart Food Finder v3.2 CSS FINAL
 * Mobile First - All Features Included
 */

/* ===== CSS VARIABLES ===== */
:root {
    --sff-primary: #b54b2a;
    --sff-primary-dark: #8b3a1f;
    --sff-primary-light: #d4613f;
    --sff-secondary: #466a8b;
    --sff-success: #28a745;
    --sff-warning: #ffc107;
    --sff-danger: #dc3545;
    --sff-gold: #ffd700;
    --sff-silver: #c0c0c0;
    --sff-bronze: #cd7f32;
    --sff-shadow: 0 4px 20px rgba(0,0,0,0.15);
    --sff-radius: 16px;
    --sff-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
.sff-modal-overlay *,
.sff-modal-overlay *::before,
.sff-modal-overlay *::after {
    box-sizing: border-box;
}

/* ===== MODAL OVERLAY ===== */
.sff-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 99999;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.sff-modal-overlay.active {
    display: flex !important;
    opacity: 1;
}

.sff-modal-container {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--sff-radius) var(--sff-radius) 0 0;
    display: flex;
    flex-direction: column;
    animation: sff-slideUp 0.3s ease;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

@keyframes sff-slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== HEADER ===== */
.sff-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--sff-primary) 0%, var(--sff-primary-dark) 100%);
    color: white;
    border-radius: var(--sff-radius) var(--sff-radius) 0 0;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.sff-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.sff-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--sff-transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    margin: 0;
}

.sff-close-btn:hover,
.sff-close-btn:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.95);
}

.sff-step-indicator {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* ===== CONTENT AREA ===== */
.sff-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    display: block !important;
    min-height: 200px;
    -webkit-overflow-scrolling: touch;
    background: #fafafa;
}

.sff-fade-in {
    animation: sff-fadeIn 0.3s ease;
}

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

/* ===== STEP TITLES ===== */
.sff-step-title {
    text-align: center;
    margin: 0 0 24px 0;
    color: #333;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

/* ===== OPTIONS GRID ===== */
.sff-options-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    visibility: visible !important;
    padding-bottom: 20px;
}

.sff-option-card {
    background: white;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--sff-transition);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(181, 75, 42, 0.1);
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sff-option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--sff-primary-light);
}

.sff-option-card:active,
.sff-option-card.touch-active {
    transform: scale(0.96);
    background: #fff5f2;
}

.sff-option-card.selected {
    background: linear-gradient(135deg, #fff5f2 0%, #ffe8e0 100%);
    border-color: var(--sff-primary);
    box-shadow: 0 0 0 3px rgba(181, 75, 42, 0.15);
}

.sff-option-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--sff-primary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.sff-option-card.selected .sff-option-title {
    color: var(--sff-primary-dark);
}

.sff-option-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
    line-height: 1;
}

.sff-option-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sff-option-desc {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
}

/* ===== FOOTER & BUTTONS ===== */
.sff-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    background: white;
    border-radius: 0 0 var(--sff-radius) var(--sff-radius);
    flex-shrink: 0;
    z-index: 10;
    gap: 12px;
}

.sff-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sff-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex: 1;
    min-height: 48px;
    position: relative;
    overflow: hidden;
}

.sff-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.sff-btn:active::after {
    width: 300px;
    height: 300px;
}

.sff-btn-primary {
    background: linear-gradient(135deg, var(--sff-primary) 0%, var(--sff-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(181, 75, 42, 0.3);
}

.sff-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(181, 75, 42, 0.4);
}

.sff-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sff-btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e0e0e0;
}

.sff-btn-secondary:hover {
    background: #e9ecef;
    color: #333;
    border-color: #d0d0d0;
}

.sff-hidden {
    display: none !important;
}

/* ===== LOADING STATE ===== */
.sff-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    min-height: 300px;
}

.sff-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--sff-primary);
    border-radius: 50%;
    animation: sff-spin 1s linear infinite;
    -webkit-animation: sff-spin 1s linear infinite;
    will-change: transform;
    margin-bottom: 20px;
}

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

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

.sff-loading-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.sff-loading-subtext {
    font-size: 13px;
    color: #888;
}

/* ===== RESULTS SCREEN ===== */
.sff-results-header {
    padding: 16px;
    background: white;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    margin: -20px -20px 16px -20px;
    position: sticky;
    top: -20px;
    z-index: 5;
}

.sff-results-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sff-results-filter {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== RESULT CARDS ===== */
.sff-result-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    position: relative;
    border: 2px solid transparent;
    transition: var(--sff-transition);
    margin-bottom: 16px;
}

.sff-result-card:last-child {
    margin-bottom: 0;
}

.sff-result-card.winner {
    border-color: var(--sff-success);
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.15);
}

.sff-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.sff-result-badge {
    position: absolute;
    top: -10px;
    left: 16px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.sff-result-badge.winner {
    background: var(--sff-success);
    color: white;
}

.sff-result-badge.second {
    background: var(--sff-secondary);
    color: white;
}

.sff-result-badge.third {
    background: #888;
    color: white;
}

.sff-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 8px;
}

.sff-result-name {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    flex: 1;
    line-height: 1.3;
    margin-top: 8px;
}

.sff-result-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--sff-primary);
    white-space: nowrap;
}

.sff-result-venue {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sff-result-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 4px;
}

.sff-result-rating {
    color: #ffa500;
    font-weight: 600;
}

/* ===== ACTION BUTTONS ===== */
.sff-result-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.sff-action-btn {
    padding: 10px 4px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: var(--sff-transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    text-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    gap: 4px;
    min-height: 52px;
}

.sff-action-btn:active {
    transform: scale(0.95);
}

.sff-action-btn span {
    font-size: 16px;
}

.sff-action-btn.call {
    background: #d4edda;
    color: #155724;
}

.sff-action-btn.map {
    background: #cce5ff;
    color: #004085;
}

.sff-action-btn.favorite {
    background: #f8f9fa;
    color: #666;
}

.sff-action-btn.favorite.active {
    background: #f8d7da;
    color: #721c24;
}

.sff-action-btn.share {
    background: #fff3cd;
    color: #856404;
}

.sff-result-view-btn {
    display: block;
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, var(--sff-primary) 0%, var(--sff-primary-dark) 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: var(--sff-transition);
    border: none;
    cursor: pointer;
    touch-action: manipulation;
}

.sff-result-view-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(181, 75, 42, 0.3);
}

/* ===== MAP STYLES ===== */
#sff-leaflet-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    touch-action: none;
    -webkit-user-drag: none;
    z-index: 1;
}

.sff-price-marker {
    background: none;
    border: none;
}

.sff-user-marker {
    background: none;
    border: none;
}

@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(0,123,255,0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0,123,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,123,255,0); }
}

.leaflet-container {
    font-family: inherit;
    background: #f8f9fa;
}

/* ===== NO RESULTS ===== */
.sff-no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--sff-radius);
    margin: 20px 0;
}

.sff-no-results h3 {
    color: #666;
    margin: 16px 0 8px 0;
    font-size: 18px;
}

.sff-no-results p {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
}

/* ===== TRIGGER BUTTONS ===== */
#sff-floating-button {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--sff-primary) 0%, var(--sff-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(181, 75, 42, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: var(--sff-transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#sff-floating-button:hover {
    transform: scale(1.1) rotate(10deg);
}

#sff-floating-button:active {
    transform: scale(0.95);
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    .sff-modal-overlay {
        align-items: center;
        padding: 20px;
    }
    
    .sff-modal-container {
        border-radius: var(--sff-radius);
        max-height: 85vh;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }
    
    .sff-step-title {
        font-size: 24px;
    }
    
    .sff-option-card {
        padding: 24px;
    }
    
    .sff-option-icon {
        font-size: 40px;
    }
}

@media (max-width: 480px) {
    .sff-modal-container {
        max-height: 95vh;
    }
    
    .sff-options-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .sff-option-card {
        display: flex;
        align-items: center;
        text-align: left;
        gap: 12px;
        padding: 16px;
    }
    
    .sff-option-icon {
        margin-bottom: 0;
        min-width: 48px;
        font-size: 28px;
    }
    
    .sff-option-title {
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .sff-option-desc {
        font-size: 11px;
    }
    
    .sff-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .sff-result-actions {
        grid-template-columns: repeat(2, 1fr);
    }
        
    .sff-step-title {
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .sff-modal-header {
        padding: 12px 16px;
    }
    
    .sff-modal-title {
        font-size: 16px;
    }
    
    .sff-modal-content {
        padding: 16px;
    }
}

/* iOS Input Zoom Fix */
@media screen and (-webkit-min-device-pixel-ratio: 0) { 
    .sff-modal-container input,
    .sff-modal-container select,
    .sff-modal-container textarea {
        font-size: 16px;
    }
}

/* ===== UTILITIES ===== */
.touch-active {
    opacity: 0.8;
}

.sff-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/**
 * Smart Food Finder Modal Styles
 * Version: 1.0
 * Feature: Popup Modal mit iframe, Blink-Effekt, Responsive
 */

/* ===== BLINK ANIMATION FÜR NEW BADGE ===== */
@keyframes sff-blink {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.4;
        transform: scale(1.05);
    }
}

/* ===== FOOTER BADGE STYLES ===== */
.sff-new-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    animation: sff-blink 1s infinite ease-in-out;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    border: 1px solid #FF8C00;
    white-space: nowrap;
}

/* Footer Link Styles - Einzeilig */
.footer-nav-item.sff-active {
    flex: 0 0 auto;
    min-width: 80px;
}

.footer-nav-link.sff-blinking {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    position: relative;
    padding: 4px 8px !important;
}

.footer-nav-link.sff-blinking .footer-nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: 10px;
    line-height: 1.2;
}

/* ===== MODAL OVERLAY ===== */
.sff-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.sff-modal-overlay.active {
    display: flex !important;
    opacity: 1;
}

/* ===== MODAL CONTAINER ===== */
.sff-modal-container {
    background: white;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    height: 90vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.4);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.sff-modal-overlay.active .sff-modal-container {
    transform: scale(1) translateY(0);
}

/* ===== MODAL HEADER ===== */
.sff-modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #b54b2a 0%, #8b3a1f 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.sff-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.3px;
}

/* ===== CLOSE BUTTON ===== */
.sff-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
}

.sff-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.sff-close-btn:active {
    transform: scale(0.95) rotate(90deg);
}

/* ===== MODAL BODY & IFRAME ===== */
.sff-modal-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

#sff-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: white;
}

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

/* Desktop: max-width 800px zentriert */
@media (min-width: 769px) {
    .sff-modal-container {
        width: 90%;
        max-width: 800px;
        border-radius: 16px;
    }
}

/* Mobile: Fullscreen */
@media (max-width: 768px) {
    .sff-modal-overlay {
        align-items: flex-end;
        padding: 0;
        background: rgba(0, 0, 0, 0.85);
    }
    
    .sff-modal-container {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
    
    .sff-modal-overlay.active .sff-modal-container {
        transform: translateY(0);
    }
    
    .sff-modal-header {
        border-radius: 0;
        padding: 12px 16px;
    }
    
    .sff-modal-title {
        font-size: 18px;
    }
    
    .sff-close-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    /* Footer Anpassungen für Mobile */
    .sff-new-badge {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    .footer-nav-link.sff-blinking {
        padding: 2px 4px !important;
    }
    
    .footer-nav-link.sff-blinking .footer-nav-text {
        font-size: 9px !important;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    .sff-modal-title {
        font-size: 16px;
    }
    
    .footer-nav-link.sff-blinking .footer-nav-text {
        font-size: 8px !important;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .sff-new-badge,
    .sff-modal-container,
    .sff-modal-overlay,
    .sff-close-btn {
        animation: none;
        transition: none;
    }
}

/* Fokus Styles für Tastatur-Navigation */
.sff-close-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
    .sff-modal-overlay,
    .footer-nav-item.sff-active {
        display: none !important;
    }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@media (max-width: 768px) {
    #food-finder-modal > div {
        width: 100% !important;
        height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* ===== WICHTIGE KORREKTUREN FÜR DAS MODAL ===== */

/* Das Modal muss initial versteckt sein */
#sff-modal-overlay {
    display: none !important;
}

/* Wenn aktiv, als Flex anzeigen */
#sff-modal-overlay.active {
    display: flex !important;
}

/* iFrame Loading Fix */
#sff-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: white;
}

/* Sicherstellen dass der Body nicht scrollt wenn offen */
body.sff-open {
    overflow: hidden !important;
}

/* ===== KEIN INLINE CSS - ALLES HIER ===== */

.sff-icon { color: #FFD700; }
.sff-text { font-size: 10px; font-weight: 800; white-space: nowrap; }

.sff-new-badge {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 4px;
    animation: sff-blink 1s infinite;
    border: 1px solid #FF8C00;
    text-transform: uppercase;
}

@keyframes sff-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* MODAL STYLES */
.sff-modal-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    justify-content: center;
    align-items: flex-end;
}

.sff-modal-container {
    background: white;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
}

@media (min-width: 769px) {
    .sff-modal-overlay { align-items: center; }
    .sff-modal-container { height: 85vh; border-radius: 16px; }
}

@media (max-width: 768px) {
    .sff-modal-container { max-width: 100%; height: 95vh; height: 95dvh; }
}

.sff-modal-header {
    background: linear-gradient(135deg, #b54b2a, #8b3a1f);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.sff-modal-title {
    margin: 0;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sff-modal-title .fa-bolt { color: #FFD700; }

.sff-close-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
    transition: background 0.2s;
}

.sff-close-btn:hover { background: rgba(255,255,255,0.3); }

.sff-modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.sff-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Body Scroll Lock & Footer Fix */
body:has(.sff-modal-overlay) {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

body:has(.sff-modal-overlay) .footer-nav {
    z-index: 1 !important;
}

/* ===================================================================
   SMART FOOD FINDER - EXTERNES CSS
   =================================================================== */

/* Overlay - fixed über ganzer Seite */
.sff-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

/* Popup Box */
.sff-box {
    background: white;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    position: relative;
    animation: sff-slide-up 0.3s ease-out;
}

@keyframes sff-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Desktop: mittig, abgerundet */
@media (min-width: 769px) {
    .sff-overlay { 
        align-items: center; 
        padding: 20px;
    }
    .sff-box { 
        height: 85vh; 
        border-radius: 16px;
        animation: sff-fade-in 0.3s ease-out;
    }
    
    @keyframes sff-fade-in {
        from {
            transform: scale(0.9);
            opacity: 0;
        }
        to {
            transform: scale(1);
            opacity: 1;
        }
    }
}

/* Mobile: fullscreen von unten */
@media (max-width: 768px) {
    .sff-box { 
        max-width: 100%; 
        height: 95vh; 
        height: 95dvh;
        border-radius: 16px 16px 0 0;
    }
}

/* Header mit Titel und X */
.sff-header {
    background: linear-gradient(135deg, #b54b2a, #8b3a1f);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.sff-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: Arial, sans-serif;
}

.sff-header .fa-bolt { 
    color: #FFD700; 
}

/* X-Button - WICHTIG: Link ohne show_food_finder! */
.sff-close {
    background: rgba(255,255,255,0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sff-close:hover { 
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* Content Bereich */
.sff-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #f5f5f5;
}

.sff-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Body Scroll sperren wenn Overlay offen */
body:has(.sff-overlay) {
    overflow: hidden !important;
}

body.sff-open {
    overflow: hidden !important;
}

/* Footer Animationen */
.sff-active { 
    position: relative; 
}

.sff-blinking {
    animation: sff-pulse 2s infinite;
}

@keyframes sff-pulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.05); 
    }
}

.sff-new-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FFD700;
    color: #333;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    animation: sff-blink 1.5s infinite;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@keyframes sff-blink {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.5; 
    }
}

/* Fallback Content Styling */
.sff-content > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-family: Arial, sans-serif;
}

.sff-content h2 {
    color: #333;
    margin-bottom: 10px;
}

.sff-content p {
    color: #666;
    margin-bottom: 20px;
}

/* Responsive Anpassungen */
@media (max-width: 480px) {
    .sff-header h3 {
        font-size: 16px;
    }
    
    .sff-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}