/**
 * Cookie Consent Banner Styles
 * Matches MathsHelp site styling
 */

/* Banner container - fixed at bottom */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--dark);
    color: white;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

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

/* Add padding to body when banner is visible to prevent content overlap */
body.cookie-banner-visible {
    padding-bottom: 60px;
}

/* Banner content wrapper */
.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Compact view - shown by default */
.cookie-compact-view {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

/* Expanded view - hidden by default */
.cookie-expanded-view {
    display: none;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem;
}

/* When expanded class is added */
#cookie-consent-banner.expanded .cookie-compact-view {
    display: none;
}

#cookie-consent-banner.expanded .cookie-expanded-view {
    display: flex;
}

/* Title */
.cookie-consent-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

/* Text section (expanded view) */
.cookie-consent-text {
    flex: 1;
    min-width: 300px;
}

.cookie-consent-text h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: white;
}

.cookie-consent-text p {
    font-size: 0.9rem;
    color: #bdc3c7;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.cookie-consent-text a {
    color: var(--primary);
    text-decoration: none;
}

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

/* Cookie options section */
.cookie-consent-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 200px;
}

/* Individual cookie option */
.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-option-label {
    display: flex;
    flex-direction: column;
}

.cookie-option-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
}

.cookie-option-desc {
    font-size: 0.75rem;
    color: #95a5a6;
}

/* Disabled state for necessary cookies */
.cookie-option.disabled .cookie-option-name {
    color: #95a5a6;
}

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

/* Toggle switch styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #7f8c8d;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--secondary);
}

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

.toggle-switch input:disabled + .toggle-slider {
    background-color: var(--secondary);
    cursor: not-allowed;
}

/* Buttons section */
.cookie-consent-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.cookie-expanded-view .cookie-consent-buttons {
    min-width: 150px;
    flex-direction: column;
}

.cookie-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-btn-primary {
    background-color: var(--secondary);
    color: white;
}

.cookie-btn-primary:hover {
    background-color: #27ae60;
}

.cookie-btn-secondary {
    background-color: transparent;
    color: white;
    border: 1px solid #7f8c8d;
    text-decoration: none;
}

.cookie-btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.cookie-btn-outline {
    background-color: transparent;
    color: #bdc3c7;
    border: 1px solid #7f8c8d;
}

.cookie-btn-outline:hover {
    color: white;
    border-color: #bdc3c7;
}

/* Mobile responsive styles */
@media (max-width: 600px) {
    #cookie-consent-banner {
        padding: 0.75rem 1rem;
    }

    body.cookie-banner-visible {
        padding-bottom: 100px;
    }

    #cookie-consent-banner.expanded {
        padding: 1rem;
    }

    body.cookie-banner-expanded {
        padding-bottom: 350px;
    }

    .cookie-compact-view {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .cookie-compact-view .cookie-consent-buttons {
        width: 100%;
        justify-content: center;
    }

    .cookie-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .cookie-expanded-view {
        flex-direction: column;
        gap: 1rem;
    }

    .cookie-consent-text {
        min-width: 100%;
    }

    .cookie-consent-options {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .cookie-option {
        flex: 1;
        min-width: 140px;
    }

    .cookie-expanded-view .cookie-consent-buttons {
        width: 100%;
        flex-direction: row;
    }

    .cookie-expanded-view .cookie-btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .cookie-consent-options {
        flex-direction: column;
    }

    .cookie-option {
        width: 100%;
    }

    .cookie-expanded-view .cookie-consent-buttons {
        flex-direction: column;
    }

    .cookie-expanded-view .cookie-btn {
        width: 100%;
    }
}

/* Footer link styling */
.cookie-preferences-link {
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.cookie-preferences-link:hover {
    text-decoration: underline;
}
