/**
 * Cookie Consent Banner - DSGVO-konform
 * AegisSight
 * Angepasst an Corporate Design (Rheinmetall Style)
 */

/* === CSS Variables (nutzt globale Tokens) === */
:root {
    --consent-primary: var(--color-navy, #0A1832);
    --consent-primary-dark: var(--color-navy-dark, #060F20);
    --consent-gray-light: var(--color-gray-100, #f4f4f4);
    --consent-white: var(--color-white, #FFFFFF);
    --consent-text-dark: var(--color-gray-800, #333333);
    --consent-text-gray: var(--color-gray-600, #666666);
    --consent-border: var(--color-gray-200, #e0e0e0);
    --consent-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --consent-shadow-hover: 0 8px 24px rgba(0,0,0,0.15);
}

/* === Demo Page Styling (AegisSight Style) === */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--consent-text-dark);
}

header {
    background: linear-gradient(135deg, var(--consent-primary-dark) 0%, var(--consent-primary) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--consent-shadow);
}

header h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

main {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Demo-Page-Reststyles: nackter footer-Selector entfernt, weil er sonst
   ueber alle Seiten den Site-Footer mit fremdem Margin/Background ueberlagert.
   Cookie-Consent-Banner-Styles bleiben unten unveraendert. */

footer nav {
    margin-bottom: 1rem;
}

footer nav a {
    color: var(--consent-primary);
    text-decoration: none;
    margin: 0 1.5rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer nav a:hover {
    color: #fff;
    text-decoration: underline;
}

/* === Cookie Consent Banner === */

/* Backdrop Overlay */
#cookie-consent-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    animation: fadeIn 0.3s ease;
}

#cookie-consent-backdrop.active {
    display: block;
}

/* Main Banner Container */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-top: 2px solid var(--color-gold, #C8A851);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

#cookie-consent-banner.active {
    transform: translateY(0);
}

/* Banner Content */
.consent-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.consent-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.consent-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--consent-text-dark);
    font-weight: 600;
}

.consent-text {
    color: var(--consent-text-gray);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.consent-text strong {
    color: var(--consent-text-dark);
}

/* Button Group */
.consent-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.consent-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.consent-btn:focus {
    outline: 3px solid rgba(52, 152, 219, 0.5);
    outline-offset: 2px;
}

.consent-btn-primary {
    background: var(--consent-primary);
    color: white;
    box-shadow: var(--consent-shadow);
}

.consent-btn-primary:hover {
    background: var(--consent-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--consent-shadow-hover);
}

.consent-btn-secondary {
    background: var(--color-gray-600, #666666);
    color: white;
}

.consent-btn-secondary:hover {
    background: var(--color-gray-800, #333333);
}

.consent-btn-outline {
    background: transparent;
    border: 2px solid var(--consent-primary);
    color: var(--consent-primary);
}

.consent-btn-outline:hover {
    background: var(--consent-primary);
    color: white;
}

/* Settings Modal */
#cookie-consent-settings {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

#cookie-consent-settings.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.settings-header {
    background: linear-gradient(135deg, var(--consent-primary-dark) 0%, var(--consent-primary) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--consent-shadow);
}

.settings-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.settings-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.settings-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-content {
    padding: 1.5rem;
}

/* Category Cards */
.cookie-category {
    border: 2px solid var(--consent-border);
    border-radius: var(--radius-md, 8px);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease;
}

.cookie-category:hover {
    border-color: var(--consent-primary);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--consent-text-dark);
}

.category-toggle {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    transition: background 0.3s ease;
    cursor: pointer;
}

.category-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.category-toggle.active {
    background: var(--color-gold, #C8A851);
}

.category-toggle.active::after {
    transform: translateX(24px);
}

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

.category-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.category-details {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #555;
}

.category-details ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.category-details li {
    margin: 0.25rem 0;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e0e0e0;
    color: #555;
    font-size: 0.75rem;
    border-radius: 4px;
    font-weight: 600;
}

.badge-required {
    background: var(--consent-primary);
    color: white;
}

/* Settings Footer */
.settings-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.settings-footer .consent-btn {
    flex: 1;
    min-width: 150px;
}

/* Links */
.settings-links {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.settings-links a {
    color: var(--consent-primary);
    text-decoration: none;
    font-weight: 600;
}

.settings-links a:hover {
    color: var(--consent-primary-dark);
    text-decoration: underline;
}

/* GPC Notice */
.gpc-notice {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.gpc-notice-icon {
    font-size: 1.5rem;
}

.gpc-notice-text {
    flex: 1;
    color: #856404;
}

.gpc-notice-text strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .consent-content {
        padding: 1rem;
    }

    .consent-header h2 {
        font-size: 1.25rem;
    }

    .consent-buttons {
        flex-direction: column;
    }

    .consent-btn {
        width: 100%;
        text-align: center;
    }

    #cookie-consent-settings {
        width: 95%;
        max-height: 90vh;
    }

    .settings-footer {
        flex-direction: column;
    }

    .settings-footer .consent-btn {
        width: 100%;
    }

    .settings-links {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    #cookie-consent-banner,
    #cookie-consent-settings,
    .category-toggle::after {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    #cookie-consent-banner {
        border-top: 3px solid #000;
    }

    .cookie-category {
        border-width: 3px;
    }
}

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