diff --git a/public/assets/css/style.css b/public/assets/css/style.css index c8154ec..2632cee 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -1854,4 +1854,293 @@ body { .legal-hero { padding: calc(var(--header-height) + var(--spacing-xl)) 0 var(--spacing-xl); } +} + +/* ========================================== + COOKIE CONSENT BANNER + ========================================== */ + +.cookie-consent { + position: fixed; + bottom: 0; + left: 0; + right: 0; + z-index: 10000; + background: rgba(13, 8, 33, 0.98); + backdrop-filter: blur(20px); + -webkit-backdrop-filter: blur(20px); + border-top: 1px solid var(--glass-border); + box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3); + transform: translateY(100%); + opacity: 0; + visibility: hidden; + transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); +} + +.cookie-consent.show { + transform: translateY(0); + opacity: 1; + visibility: visible; +} + +.cookie-consent.hide { + transform: translateY(100%); + opacity: 0; + visibility: hidden; +} + +.cookie-consent-container { + max-width: 1200px; + margin: 0 auto; + padding: var(--spacing-xl) var(--spacing-lg); + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: var(--spacing-lg); +} + +.cookie-consent-content { + display: flex; + align-items: flex-start; + gap: var(--spacing-lg); + flex: 1; + min-width: 300px; +} + +.cookie-consent-icon { + width: 48px; + height: 48px; + flex-shrink: 0; + color: var(--primary-color); +} + +.cookie-consent-icon svg { + width: 100%; + height: 100%; +} + +.cookie-consent-text h3 { + font-size: var(--font-size-lg); + font-weight: 600; + margin-bottom: var(--spacing-sm); + color: var(--text-primary); +} + +.cookie-consent-text p { + font-size: var(--font-size-sm); + color: var(--text-secondary); + line-height: 1.6; + margin: 0; +} + +.cookie-consent-text a { + color: var(--primary-color); + text-decoration: none; + font-weight: 500; +} + +.cookie-consent-text a:hover { + text-decoration: underline; +} + +.cookie-consent-actions { + display: flex; + flex-wrap: wrap; + gap: var(--spacing-md); + align-items: center; +} + +.cookie-consent-actions .btn { + white-space: nowrap; +} + +.btn-text { + background: transparent; + color: var(--text-secondary); + border: none; + padding: var(--spacing-sm) var(--spacing-md); + font-weight: 500; + cursor: pointer; + transition: color var(--transition-base); +} + +.btn-text:hover { + color: var(--primary-color); +} + +/* Cookie Settings Panel */ +.cookie-settings-panel { + border-top: 1px solid var(--glass-border); + background: rgba(0, 0, 0, 0.3); + animation: slideDown 0.3s ease-out; +} + +@keyframes slideDown { + from { + opacity: 0; + transform: translateY(-10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.cookie-settings-content { + max-width: 800px; + margin: 0 auto; + padding: var(--spacing-xl) var(--spacing-lg); +} + +.cookie-settings-content h4 { + font-size: var(--font-size-lg); + font-weight: 600; + margin-bottom: var(--spacing-lg); + color: var(--text-primary); +} + +.cookie-option { + display: flex; + justify-content: space-between; + align-items: center; + padding: var(--spacing-md) 0; + border-bottom: 1px solid rgba(255, 255, 255, 0.1); +} + +.cookie-option:last-of-type { + border-bottom: none; +} + +.cookie-option-info { + flex: 1; + padding-right: var(--spacing-lg); +} + +.cookie-option-info strong { + display: block; + font-size: var(--font-size-base); + font-weight: 600; + color: var(--text-primary); + margin-bottom: var(--spacing-xs); +} + +.cookie-option-info p { + font-size: var(--font-size-sm); + color: var(--text-secondary); + margin: 0; + line-height: 1.5; +} + +/* Cookie Toggle Switch */ +.cookie-toggle { + position: relative; + display: inline-block; + width: 52px; + height: 28px; + flex-shrink: 0; +} + +.cookie-toggle input { + opacity: 0; + width: 0; + height: 0; +} + +.cookie-toggle-slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.2); + border-radius: 28px; + transition: all var(--transition-base); +} + +.cookie-toggle-slider::before { + position: absolute; + content: ""; + height: 22px; + width: 22px; + left: 3px; + bottom: 3px; + background: var(--text-primary); + border-radius: 50%; + transition: all var(--transition-base); +} + +.cookie-toggle input:checked + .cookie-toggle-slider { + background: linear-gradient(135deg, var(--primary-color), var(--accent-color-1)); +} + +.cookie-toggle input:checked + .cookie-toggle-slider::before { + transform: translateX(24px); +} + +.cookie-toggle.disabled .cookie-toggle-slider { + cursor: not-allowed; + opacity: 0.7; +} + +.cookie-toggle input:focus + .cookie-toggle-slider { + box-shadow: 0 0 0 3px rgba(255, 81, 249, 0.3); +} + +.cookie-settings-actions { + display: flex; + gap: var(--spacing-md); + justify-content: flex-end; + margin-top: var(--spacing-xl); + padding-top: var(--spacing-lg); + border-top: 1px solid rgba(255, 255, 255, 0.1); +} + +/* Cookie Consent Responsive */ +@media (max-width: 768px) { + .cookie-consent-container { + flex-direction: column; + align-items: stretch; + padding: var(--spacing-lg); + } + + .cookie-consent-content { + flex-direction: column; + align-items: center; + text-align: center; + } + + .cookie-consent-icon { + width: 40px; + height: 40px; + } + + .cookie-consent-actions { + flex-direction: column; + width: 100%; + } + + .cookie-consent-actions .btn { + width: 100%; + justify-content: center; + } + + .cookie-settings-actions { + flex-direction: column; + } + + .cookie-settings-actions .btn { + width: 100%; + } + + .cookie-option { + flex-direction: column; + align-items: flex-start; + gap: var(--spacing-md); + } + + .cookie-option-info { + padding-right: 0; + } } \ No newline at end of file diff --git a/public/assets/js/cookie-consent.js b/public/assets/js/cookie-consent.js new file mode 100644 index 0000000..a55385d --- /dev/null +++ b/public/assets/js/cookie-consent.js @@ -0,0 +1,322 @@ +/** + * Cookie Consent Manager für HexaHost.de + * DSGVO-konformes Cookie-Banner mit granularen Einstellungen + */ +(function() { + 'use strict'; + + // Cookie-Konfiguration + const COOKIE_NAME = 'hexahost_cookie_consent'; + const COOKIE_EXPIRY_DAYS = 365; + + // DOM-Elemente + const banner = document.getElementById('cookieConsent'); + const settingsPanel = document.getElementById('cookieSettingsPanel'); + const acceptAllBtn = document.getElementById('cookieAcceptAll'); + const acceptEssentialBtn = document.getElementById('cookieAcceptEssential'); + const settingsBtn = document.getElementById('cookieSettings'); + const saveSettingsBtn = document.getElementById('cookieSaveSettings'); + const closeSettingsBtn = document.getElementById('cookieCloseSettings'); + const analyticsCheckbox = document.getElementById('cookieAnalytics'); + const marketingCheckbox = document.getElementById('cookieMarketing'); + + /** + * Cookie-Hilfsfunktionen + */ + const CookieUtils = { + set: function(name, value, days) { + const date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + const expires = 'expires=' + date.toUTCString(); + document.cookie = name + '=' + JSON.stringify(value) + ';' + expires + ';path=/;SameSite=Lax;Secure'; + }, + + get: function(name) { + const nameEQ = name + '='; + const cookies = document.cookie.split(';'); + for (let i = 0; i < cookies.length; i++) { + let cookie = cookies[i].trim(); + if (cookie.indexOf(nameEQ) === 0) { + try { + return JSON.parse(cookie.substring(nameEQ.length)); + } catch (e) { + return null; + } + } + } + return null; + }, + + delete: function(name) { + document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;'; + } + }; + + /** + * Cookie Consent Manager + */ + const CookieConsent = { + // Standardeinstellungen + defaultConsent: { + essential: true, // Immer aktiviert + analytics: false, + marketing: false, + timestamp: null + }, + + /** + * Initialisierung + */ + init: function() { + if (!banner) return; + + const consent = this.getConsent(); + + if (consent && consent.timestamp) { + // Consent bereits gegeben - Banner verstecken + this.hideBanner(); + this.applyConsent(consent); + } else { + // Zeige Banner + this.showBanner(); + } + + this.bindEvents(); + }, + + /** + * Event-Listener binden + */ + bindEvents: function() { + if (acceptAllBtn) { + acceptAllBtn.addEventListener('click', () => this.acceptAll()); + } + + if (acceptEssentialBtn) { + acceptEssentialBtn.addEventListener('click', () => this.acceptEssential()); + } + + if (settingsBtn) { + settingsBtn.addEventListener('click', () => this.showSettings()); + } + + if (saveSettingsBtn) { + saveSettingsBtn.addEventListener('click', () => this.saveSettings()); + } + + if (closeSettingsBtn) { + closeSettingsBtn.addEventListener('click', () => this.hideSettings()); + } + + // ESC-Taste zum Schließen der Einstellungen + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape' && settingsPanel && settingsPanel.style.display !== 'none') { + this.hideSettings(); + } + }); + }, + + /** + * Alle Cookies akzeptieren + */ + acceptAll: function() { + const consent = { + essential: true, + analytics: true, + marketing: true, + timestamp: new Date().toISOString() + }; + this.saveConsent(consent); + this.hideBanner(); + this.applyConsent(consent); + this.showNotification('Alle Cookies wurden akzeptiert.', 'success'); + }, + + /** + * Nur essenzielle Cookies akzeptieren + */ + acceptEssential: function() { + const consent = { + essential: true, + analytics: false, + marketing: false, + timestamp: new Date().toISOString() + }; + this.saveConsent(consent); + this.hideBanner(); + this.applyConsent(consent); + this.showNotification('Nur notwendige Cookies wurden akzeptiert.', 'info'); + }, + + /** + * Einstellungen speichern + */ + saveSettings: function() { + const consent = { + essential: true, + analytics: analyticsCheckbox ? analyticsCheckbox.checked : false, + marketing: marketingCheckbox ? marketingCheckbox.checked : false, + timestamp: new Date().toISOString() + }; + this.saveConsent(consent); + this.hideSettings(); + this.hideBanner(); + this.applyConsent(consent); + this.showNotification('Cookie-Einstellungen wurden gespeichert.', 'success'); + }, + + /** + * Consent im Cookie speichern + */ + saveConsent: function(consent) { + CookieUtils.set(COOKIE_NAME, consent, COOKIE_EXPIRY_DAYS); + }, + + /** + * Consent aus Cookie lesen + */ + getConsent: function() { + return CookieUtils.get(COOKIE_NAME); + }, + + /** + * Consent anwenden (z.B. Analytics laden) + */ + applyConsent: function(consent) { + // Dispatch Custom Event für andere Scripts + window.dispatchEvent(new CustomEvent('cookieConsentUpdated', { + detail: consent + })); + + // Analytics aktivieren/deaktivieren + if (consent.analytics) { + this.enableAnalytics(); + } else { + this.disableAnalytics(); + } + + // Marketing aktivieren/deaktivieren + if (consent.marketing) { + this.enableMarketing(); + } else { + this.disableMarketing(); + } + }, + + /** + * Analytics aktivieren (Placeholder für z.B. Google Analytics) + */ + enableAnalytics: function() { + // Hier können Analytics-Scripts geladen werden + // Beispiel für Google Analytics: + // if (typeof gtag === 'undefined') { + // const script = document.createElement('script'); + // script.src = 'https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID'; + // script.async = true; + // document.head.appendChild(script); + // } + console.log('Analytics enabled'); + }, + + /** + * Analytics deaktivieren + */ + disableAnalytics: function() { + // Analytics-Cookies entfernen falls vorhanden + console.log('Analytics disabled'); + }, + + /** + * Marketing aktivieren (Placeholder für Marketing-Tools) + */ + enableMarketing: function() { + console.log('Marketing enabled'); + }, + + /** + * Marketing deaktivieren + */ + disableMarketing: function() { + console.log('Marketing disabled'); + }, + + /** + * Banner anzeigen + */ + showBanner: function() { + if (banner) { + banner.classList.add('show'); + banner.setAttribute('aria-hidden', 'false'); + // Fokus auf ersten Button setzen für Accessibility + setTimeout(() => { + if (acceptAllBtn) acceptAllBtn.focus(); + }, 100); + } + }, + + /** + * Banner verstecken + */ + hideBanner: function() { + if (banner) { + banner.classList.remove('show'); + banner.classList.add('hide'); + banner.setAttribute('aria-hidden', 'true'); + } + }, + + /** + * Einstellungen-Panel anzeigen + */ + showSettings: function() { + if (settingsPanel) { + // Aktuelle Einstellungen in Checkboxen laden + const consent = this.getConsent() || this.defaultConsent; + if (analyticsCheckbox) analyticsCheckbox.checked = consent.analytics; + if (marketingCheckbox) marketingCheckbox.checked = consent.marketing; + + settingsPanel.style.display = 'block'; + settingsPanel.setAttribute('aria-hidden', 'false'); + } + }, + + /** + * Einstellungen-Panel verstecken + */ + hideSettings: function() { + if (settingsPanel) { + settingsPanel.style.display = 'none'; + settingsPanel.setAttribute('aria-hidden', 'true'); + } + }, + + /** + * Notification anzeigen (nutzt HexaHost-Notification-System falls verfügbar) + */ + showNotification: function(message, type) { + if (window.HexaHost && typeof window.HexaHost.showNotification === 'function') { + window.HexaHost.showNotification(message, type); + } + }, + + /** + * Consent zurücksetzen (für Datenschutz-Link) + */ + resetConsent: function() { + CookieUtils.delete(COOKIE_NAME); + this.showBanner(); + if (settingsPanel) settingsPanel.style.display = 'none'; + } + }; + + // Initialisierung wenn DOM geladen + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', () => CookieConsent.init()); + } else { + CookieConsent.init(); + } + + // Globaler Zugriff für manuelle Steuerung + window.CookieConsent = CookieConsent; + +})(); diff --git a/public/includes/footer.php b/public/includes/footer.php index 9002701..834ac4a 100644 --- a/public/includes/footer.php +++ b/public/includes/footer.php @@ -47,10 +47,83 @@ - + +
+ + + - +diff --git a/public/includes/header.php b/public/includes/header.php index 69e4d83..94f7a48 100644 --- a/public/includes/header.php +++ b/public/includes/header.php @@ -3,13 +3,59 @@
-
- + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + - + + + + + +