/* ==========================================================================
   Cookie Consent Banner - DSGVO-konform mit granularen Kategorien
   Design: stoerkens Design Language (Dark + Lime Accent)
   ========================================================================== */

/* Banner Container */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 1rem;
    pointer-events: none;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.cookie-banner__inner {
    max-width: 680px;
    margin: 0 auto;
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    border-radius: 24px;
    padding: 1.75rem 2rem;
    box-shadow:
        0 -10px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    pointer-events: auto;

    /* Initial state for animation */
    opacity: 0;
    transform: translateY(100%) scale(0.95);
    transition: none;
}

/* Animated entrance */
.cookie-banner.is-visible .cookie-banner__inner {
    animation: bannerSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Exit animation */
.cookie-banner.is-hiding .cookie-banner__inner {
    animation: bannerSlideOut 0.4s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

@keyframes bannerSlideIn {
    0% {
        opacity: 0;
        transform: translateY(100%) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bannerSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
}

/* Header row: Icon + Title + Text */
.cookie-banner__header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Cookie Icon */
.cookie-banner__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #B9FF66;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.cookie-banner__icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
    border-radius: inherit;
}

.cookie-banner__icon svg {
    width: 24px;
    height: 24px;
    color: #18181b;
    position: relative;
    z-index: 1;
}

.cookie-banner.is-visible .cookie-banner__icon {
    animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes iconBounce {
    0% {
        transform: scale(0) rotate(-20deg);
    }
    60% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.cookie-banner__icon::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background: #18181b;
    border-radius: 50%;
    top: 10px;
    right: 12px;
    box-shadow:
        -7px 7px 0 #18181b,
        -16px 2px 0 #18181b,
        -5px 16px 0 #18181b;
    opacity: 0.3;
}

/* Content */
.cookie-banner__content {
    flex: 1;
    min-width: 0;
}

.cookie-banner__title {
    color: #ffffff;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.cookie-banner__text {
    color: #a1a1aa;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.cookie-banner__text a {
    color: #B9FF66;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.cookie-banner__text a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #B9FF66;
    transition: width 0.3s ease;
}

.cookie-banner__text a:hover::after {
    width: 100%;
}

/* ==========================================================================
   Category Toggles
   ========================================================================== */

.cookie-banner__categories {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.25rem;
    border: 1px solid #3f3f46;
    border-radius: 14px;
    overflow: hidden;
}

.cookie-banner__categories.is-open {
    display: flex;
}

.cookie-banner__category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #3f3f46;
    transition: background 0.2s ease;
}

.cookie-banner__category:last-child {
    border-bottom: none;
}

.cookie-banner__category:hover {
    background: rgba(255, 255, 255, 0.03);
}

.cookie-banner__category-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
    padding-right: 1rem;
}

.cookie-banner__category-name {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
}

.cookie-banner__category-desc {
    color: #71717a;
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Toggle Switch */
.cookie-banner__toggle {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
}

.cookie-banner__toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-banner__toggle-track {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #3f3f46;
    border-radius: 24px;
    transition: background 0.25s ease;
}

.cookie-banner__toggle-track::after {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #71717a;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner__toggle input:checked + .cookie-banner__toggle-track {
    background: #B9FF66;
}

.cookie-banner__toggle input:checked + .cookie-banner__toggle-track::after {
    background: #18181b;
    transform: translateX(20px);
}

.cookie-banner__toggle input:disabled + .cookie-banner__toggle-track {
    opacity: 0.6;
    cursor: not-allowed;
}

.cookie-banner__toggle input:disabled:checked + .cookie-banner__toggle-track {
    background: #B9FF66;
    opacity: 0.7;
}

.cookie-banner__toggle input:focus-visible + .cookie-banner__toggle-track {
    outline: 2px solid #B9FF66;
    outline-offset: 2px;
}

/* Required badge */
.cookie-banner__badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #B9FF66;
    background: rgba(185, 255, 102, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.cookie-banner__buttons {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.cookie-banner__btn {
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    min-width: 0;
}

/* Button hover ripple effect */
.cookie-banner__btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.3) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cookie-banner__btn:hover::before {
    opacity: 1;
}

/* Accept All - Primary */
.cookie-banner__btn--accept-all {
    background: #B9FF66;
    color: #18181b;
    box-shadow: 0 4px 15px rgba(185, 255, 102, 0.3);
}

.cookie-banner__btn--accept-all:hover {
    background: #c8ff85;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(185, 255, 102, 0.4);
}

.cookie-banner__btn--accept-all:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(185, 255, 102, 0.3);
}

/* Save Selection - Secondary Filled */
.cookie-banner__btn--save {
    background: #3f3f46;
    color: #ffffff;
    display: none;
}

.cookie-banner__btn--save.is-visible {
    display: block;
}

.cookie-banner__btn--save:hover {
    background: #52525b;
    transform: translateY(-2px);
}

.cookie-banner__btn--save:active {
    transform: translateY(0);
}

/* Decline All - Ghost */
.cookie-banner__btn--decline {
    background: transparent;
    color: #a1a1aa;
    border: 1px solid #3f3f46;
}

.cookie-banner__btn--decline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: #52525b;
    transform: translateY(-2px);
}

.cookie-banner__btn--decline:active {
    transform: translateY(0);
}

/* Settings Link */
.cookie-banner__settings-link {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    color: #71717a;
    font-size: 0.8125rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.25rem;
    font-family: inherit;
    transition: color 0.2s ease;
    width: 100%;
}

.cookie-banner__settings-link:hover {
    color: #B9FF66;
}

.cookie-banner__settings-link.is-hidden {
    display: none;
}

/* Button entrance animation */
.cookie-banner.is-visible .cookie-banner__btn {
    animation: buttonFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cookie-banner.is-visible .cookie-banner__btn--decline {
    animation-delay: 0.35s;
}

.cookie-banner.is-visible .cookie-banner__btn--save {
    animation-delay: 0.4s;
}

.cookie-banner.is-visible .cookie-banner__btn--accept-all {
    animation-delay: 0.45s;
}

@keyframes buttonFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .cookie-banner {
        padding: 0.625rem;
    }

    .cookie-banner__inner {
        padding: 1.25rem;
        border-radius: 20px;
    }

    .cookie-banner__header {
        gap: 1rem;
    }

    .cookie-banner__icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .cookie-banner__icon svg {
        width: 20px;
        height: 20px;
    }

    .cookie-banner__title {
        font-size: 1rem;
    }

    .cookie-banner__text {
        font-size: 0.8125rem;
    }

    .cookie-banner__buttons {
        flex-direction: column;
    }

    .cookie-banner__btn {
        width: 100%;
        padding: 0.875rem 1rem;
    }

    .cookie-banner__category {
        padding: 0.75rem;
    }

    .cookie-banner__category-name {
        font-size: 0.8125rem;
    }

    .cookie-banner__category-desc {
        font-size: 0.6875rem;
    }
}

/* ==========================================================================
   Reduced Motion Preference
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cookie-banner__inner,
    .cookie-banner__icon,
    .cookie-banner__btn {
        animation: none !important;
        transition: opacity 0.2s ease !important;
    }

    .cookie-banner.is-visible .cookie-banner__inner {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .cookie-banner__toggle-track::after {
        transition: none !important;
    }
}

/* Hidden state */
.cookie-banner[hidden] {
    display: none;
}
