/**
 * Cookie Consent Banner Styles
 * Professional design matching the reference image with light gray background
 */

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    font-family: 'Open Sans', Arial, sans-serif;
}

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

.consent-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.consent-text {
    flex: 1;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.consent-text p {
    margin: 0 0 8px 0;
    color: #555;
}

.cookie-policy-link {
    color: var(--color-accent, #4db6e2);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-policy-link:hover {
    color: var(--color-heading, #1a7fac);
    text-decoration: none;
}

.consent-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/* Button Styles */
.consent-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 100px;
    text-align: center;
}

.btn-preferences {
    background-color: transparent;
    color: #666;
    border: 2px solid #ddd;
}

.btn-preferences:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
    color: #333;
}

.btn-accept {
    background-color: #2563eb;
    color: white;
    border: 2px solid #2563eb;
}

.btn-accept:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-accept:active {
    transform: translateY(0);
}

/* Focus states for accessibility */
.consent-btn:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 2px;
}

/* Dark theme support */
body.dark-theme .cookie-consent-banner {
    background-color: var(--color-card-dark, #153e59);
    border-top-color: var(--color-border-dark, #2a5574);
}

body.dark-theme .consent-text p {
    color: var(--color-text-secondary, #a7c6db);
}

body.dark-theme .cookie-policy-link {
    color: var(--color-accent-dark, #5dbfef);
}

body.dark-theme .btn-preferences {
    color: var(--color-text-secondary, #a7c6db);
    border-color: var(--color-border-dark, #2a5574);
}

body.dark-theme .btn-preferences:hover {
    background-color: var(--color-hover-bg-dark, rgba(93, 191, 239, 0.15));
    border-color: var(--color-accent-dark, #5dbfef);
    color: var(--color-text-light, #e8f4fc);
}

/* Cookie Preferences Modal */
.cookie-preferences-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cookie-preferences-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.cookie-preferences-modal.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 24px 0 24px;
    border-bottom: 1px solid #eee;
    margin-bottom: 24px;
}

.modal-title {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-heading, #1a7fac);
}

.modal-description {
    margin: 0 0 24px 0;
    color: #666;
    line-height: 1.5;
}

.modal-body {
    padding: 0 24px 24px 24px;
}

.preference-category {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.preference-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 16px;
}

.category-header > div {
    flex: 1;
}

.category-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.category-description {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    cursor: pointer;
}

.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: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2563eb;
}

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

.toggle-switch input:disabled + .toggle-slider {
    background-color: #10b981;
    cursor: not-allowed;
    opacity: 1;
    border: 2px solid #059669;
}

.toggle-switch input:disabled + .toggle-slider:before {
    background-color: white;
    cursor: not-allowed;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Ensure disabled toggles show as "ON" and required */
.toggle-switch input:disabled:checked + .toggle-slider {
    background-color: #10b981;
    border-color: #059669;
}

.toggle-switch input:disabled:checked + .toggle-slider:before {
    background-color: white;
    transform: translateX(26px);
}

/* Add a small "Required" indicator */
.toggle-switch input:disabled + .toggle-slider::after {
    content: "Required";
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
}

/* Special styling for Essential cookies toggle */
#essential-toggle:disabled + .toggle-slider {
    background-color: #10b981 !important;
    border: 2px solid #059669 !important;
    opacity: 1 !important;
}

#essential-toggle:disabled:checked + .toggle-slider {
    background-color: #10b981 !important;
    border-color: #059669 !important;
}

#essential-toggle:disabled:checked + .toggle-slider:before {
    background-color: white !important;
    transform: translateX(26px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Focus states for accessibility */
.toggle-switch input:focus + .toggle-slider {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* Larger touch target on small screens */
@media (max-width: 480px) {
    .toggle-switch {
        width: 56px;
        height: 28px;
        /* Ensure good touch target */
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .toggle-slider {
        width: 56px;
        height: 28px;
    }

    .toggle-slider:before {
        height: 22px;
        width: 22px;
        left: 3px;
        bottom: 3px;
    }

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

/* Modal Actions */
.modal-actions {
    padding: 20px 24px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 100px;
}

.btn-cancel {
    background-color: transparent;
    color: #666;
    border: 2px solid #ddd;
}

.btn-cancel:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}

.btn-save {
    background-color: #2563eb;
    color: white;
    border: 2px solid #2563eb;
}

.btn-save:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

/* Dark theme modal */
body.dark-theme .modal-content {
    background-color: var(--color-card-dark, #153e59);
    color: var(--color-text-light, #e8f4fc);
}

body.dark-theme .modal-header {
    border-bottom-color: var(--color-border-dark, #2a5574);
}

body.dark-theme .modal-title {
    color: var(--color-accent-dark, #5dbfef);
}

body.dark-theme .modal-description {
    color: var(--color-text-secondary, #a7c6db);
}

body.dark-theme .preference-category {
    border-bottom-color: var(--color-border-dark, #2a5574);
}

body.dark-theme .category-title {
    color: var(--color-text-light, #e8f4fc);
}

body.dark-theme .category-description {
    color: var(--color-text-secondary, #a7c6db);
}

body.dark-theme .modal-actions {
    border-top-color: var(--color-border-dark, #2a5574);
}

body.dark-theme .btn-cancel {
    color: var(--color-text-secondary, #a7c6db);
    border-color: var(--color-border-dark, #2a5574);
}

body.dark-theme .btn-cancel:hover {
    background-color: var(--color-hover-bg-dark, rgba(93, 191, 239, 0.15));
    border-color: var(--color-accent-dark, #5dbfef);
}

/* Responsive Design */
@media (max-width: 768px) {
    .consent-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px 16px;
    }

    .consent-text {
        text-align: center;
    }

    .consent-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .consent-btn {
        flex: 1;
        min-width: 120px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
        max-height: calc(100vh - 40px);
    }

    .modal-header,
    .modal-body,
    .modal-actions {
        padding-left: 16px;
        padding-right: 16px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .consent-content {
        padding: 16px 12px;
    }

    .consent-text {
        font-size: 13px;
    }

    .consent-btn {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 100px;
    }

    .modal-title {
        font-size: 20px;
    }

    .category-header {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .toggle-switch {
        margin-left: auto;
    }
}

/* Animation for smooth appearance */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-consent-banner.animate-in {
    animation: slideUp 0.4s ease-out;
}

/* Cookie Settings Link (for footer) */
.cookie-settings-link {
    color: var(--color-accent, #4db6e2);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.cookie-settings-link:hover {
    color: var(--color-heading, #1a7fac);
    text-decoration: underline;
}

body.dark-theme .cookie-settings-link {
    color: var(--color-accent-dark, #5dbfef);
}

body.dark-theme .cookie-settings-link:hover {
    color: var(--color-text-light, #e8f4fc);
}