/**
 * Cookie Consent Banner Styles
 * Works in both light and dark mode via CSS custom properties.
 */

/* Banner container - fixed to bottom */
#cookie-consent-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    padding: 0;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#cookie-consent-banner.cc-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Inner card */
.cc-banner-inner {
    max-width: 720px;
    margin: 0 auto 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
    background: var(--theme-background-secondary-bg, #fff);
    color: var(--theme-foreground, #212529);
    border: 1px solid var(--theme-border-color, #2E2E2E);
}

/* Title */
.cc-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Description */
.cc-description {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

.cc-description a {
    color: var(--theme-link-color, #0d6efd);
    text-decoration: underline;
}

/* Button row */
.cc-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.cc-btn {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.cc-btn:hover {
    opacity: 0.9;
}

.cc-btn-primary {
    background: #FF4E4E;
    color: #fff;
}

.cc-btn-secondary {
    background: #FF4E4E;
    color: #fff;
}

/* Dark mode overrides with safe fallbacks */
.dark .cc-banner-inner {
    background: var(--theme-background-secondary-bg, #1A1A1A);
    color: var(--theme-foreground, #F2F2F2);
    border-color: var(--theme-border-color, #2E2E2E);
}

.dark .cc-btn-secondary {
    background: #FF4E4E;
    color: #fff;
}

.dark .cc-btn-link {
    color: #FF4E4E;
}

.dark .cc-toggle-slider {
    background: #444;
}

.cc-btn-link {
    background: none;
    border: none;
    color: var(--theme-link-color, #0d6efd);
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
}

/* Details section */
.cc-details {
    display: none;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--theme-border-color, #dee2e6);
}

/* Category row */
.cc-category {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.5rem 0;
    gap: 1rem;
}

.cc-category + .cc-category {
    border-top: 1px solid var(--theme-border-color, #dee2e6);
}

.cc-category-info {
    flex: 1;
}

.cc-category-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.cc-category-desc {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 0.15rem;
}

.cc-category-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-top: 0.15rem;
}

/* Toggle switch */
.cc-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.cc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cc-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 22px;
    transition: background 0.2s;
}

.cc-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.cc-toggle input:checked + .cc-toggle-slider {
    background: #FF4E4E;
}

.cc-toggle input:checked + .cc-toggle-slider::before {
    transform: translateX(18px);
}

.cc-toggle input:disabled + .cc-toggle-slider {
    background: #FF4E4E;
    opacity: 0.6;
    cursor: not-allowed;
}

.cc-always-active {
    font-size: 0.75rem;
    font-weight: 500;
    color: #FF4E4E;
    white-space: nowrap;
}

/* Save button in details */
.cc-details-save {
    margin-top: 0.75rem;
    text-align: right;
}

/* Responsive */
@media (max-width: 576px) {
    .cc-banner-inner {
        margin: 0;
        border-radius: 12px 12px 0 0;
    }

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

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