/**
 * B2B Prime Leads - Custom CSS
 * Zusätzliche Styles ergänzend zu Tailwind CSS
 * Version: 1.0.0
 * Stand: 2025-05-11
 */

/* ========================================
   Performance & Critical CSS
   ======================================== */

/* Font Loading Optimization */
@font-face {
    font-family: 'Inter';
    font-display: swap;
}

/* Smooth Scrolling (Fallback für ältere Browser) */
html {
    scroll-behavior: smooth;
}

/* Prevent Layout Shift */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Custom Animations
   ======================================== */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Pulse Animation für CTAs */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse-on-hover:hover {
    animation: pulse 0.6s ease-in-out;
}

/* ========================================
   Custom Scrollbar (für Desktop)
   ======================================== */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 #F1F5F9;
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

/* Focus Styles (WCAG 2.2) */
a:focus, button:focus, input:focus, textarea:focus, select:focus {
    outline: 3px solid #F59E0B;
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    background: #F59E0B;
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    font-weight: 600;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    header, footer, #cookie-consent-banner, #back-to-top {
        display: none !important;
    }
    
    body {
        color: black;
        background: white;
    }
    
    a {
        text-decoration: underline;
        color: black;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ========================================
   Mobile Optimizations
   ======================================== */

@media (max-width: 768px) {
    /* Touch Target Size (WCAG 2.2) */
    button, a, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent Zoom on Input Focus (iOS) */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Optimize Table for Mobile */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   Hero Background Pattern (Performance)
   ======================================== */

.hero-pattern {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    will-change: transform;
}

/* ========================================
   Card Hover Effects
   ======================================== */

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Button Loading State
   ======================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.6s linear infinite;
}

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

/* ========================================
   Form Validation Feedback
   ======================================== */

input:invalid:not(:placeholder-shown) {
    border-color: #EF4444;
}

input:valid:not(:placeholder-shown) {
    border-color: #10B981;
}

input:invalid:not(:placeholder-shown):focus {
    ring-color: #EF4444;
}

/* ========================================
   Cookie Banner Slide-In Animation
   ======================================== */

/* ========================================
   Cookie Consent Banner - DSGVO/TTDSG-konform
   ======================================== */

.cookie-consent-banner {
    position: fixed;
    bottom: -500px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.98) 0%, rgba(31, 41, 55, 0.98) 100%);
    backdrop-filter: blur(10px);
    border-top: 2px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

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

.cookie-consent-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .cookie-consent-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.cookie-consent-text {
    flex: 1;
}

.cookie-consent-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0 0 0.5rem 0;
}

.cookie-consent-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

.cookie-consent-link {
    color: #F59E0B;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-consent-link:hover {
    color: #FBB042;
}

.cookie-consent-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.cookie-consent-actions .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.cookie-consent-actions .btn-primary {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    color: white;
}

.cookie-consent-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.cookie-consent-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-consent-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.cookie-consent-actions .btn-text {
    background: transparent;
    color: #F59E0B;
    padding: 0.625rem 0.75rem;
}

.cookie-consent-actions .btn-text:hover {
    text-decoration: underline;
}

/* Cookie Settings Modal */
.cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1rem;
}

.cookie-settings-modal.show {
    opacity: 1;
    visibility: visible;
}

.cookie-settings-content {
    background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-settings-modal.show .cookie-settings-content {
    transform: scale(1);
}

.cookie-settings-header {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 2px solid #E5E7EB;
}

.cookie-settings-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.cookie-settings-header p {
    font-size: 0.95rem;
    color: #6B7280;
    margin: 0;
    line-height: 1.6;
}

.cookie-settings-body {
    padding: 1.5rem 2rem;
}

.cookie-category {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease;
}

.cookie-category:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.cookie-category-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-category-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
}

.cookie-category-description {
    font-size: 0.9rem;
    color: #6B7280;
    line-height: 1.6;
    margin: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    background: #D1D5DB;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
}

.toggle-switch.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-switch-slider {
    transform: translateX(24px);
}

.cookie-settings-footer {
    padding: 1rem 2rem 2rem 2rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 2px solid #E5E7EB;
}

.cookie-settings-footer .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.cookie-settings-footer .btn-primary {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    color: white;
}

.cookie-settings-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.cookie-settings-footer .btn-secondary {
    background: #F3F4F6;
    color: #374151;
}

.cookie-settings-footer .btn-secondary:hover {
    background: #E5E7EB;
}

/* Mobile Optimierungen */
@media (max-width: 768px) {
    .cookie-consent-content {
        padding: 1.25rem 1rem;
    }
    
    .cookie-consent-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .cookie-consent-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-settings-content {
        border-radius: 12px 12px 0 0;
        margin-top: auto;
        max-height: 85vh;
    }
    
    .cookie-settings-header,
    .cookie-settings-body,
    .cookie-settings-footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    .cookie-settings-footer {
        flex-direction: column-reverse;
    }
    
    .cookie-settings-footer .btn {
        width: 100%;
    }
}

#cookie-consent-banner {
    will-change: transform;
}

/* ========================================
   FAQ Animation (Smooth)
   ======================================== */

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.faq-answer:not(.hidden) {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

/* ========================================
   Gradient Text Effect
   ======================================== */

.gradient-text {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Loading Skeleton (für zukünftige Features)
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Custom Badge Styles
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

/* ========================================
   Utilities
   ======================================== */

/* Text Selection */
::selection {
    background-color: #F59E0B;
    color: white;
}

::-moz-selection {
    background-color: #F59E0B;
    color: white;
}

/* No Select (für bestimmte UI-Elemente) */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Glassmorphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========================================
   Performance: GPU Acceleration
   ======================================== */

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ========================================
   Dark Mode Support (Future)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Wird aktiviert, sobald Dark Mode gewünscht ist */
    /* body { background: #0F172A; color: #F1F5F9; } */
}

/* ========================================
   High Contrast Mode (Accessibility)
   ======================================== */

@media (prefers-contrast: high) {
    button, a {
        border: 2px solid currentColor;
    }
}
