/**
 * CookiesToo - Modern Cookie Banner Styles
 */

/* Banner Container */
.cookiestoo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Overlay */
.cookiestoo-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* Banner Container */
.cookiestoo-banner-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
    animation: cookiestooSlideUp 0.4s ease-out;
}

@keyframes cookiestooSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Banner Content */
.cookiestoo-banner-content {
    padding: 32px 24px 40px;
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
.cookiestoo-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.cookiestoo-banner-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.cookiestoo-close-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookiestoo-close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Message */
.cookiestoo-banner-message {
    margin-bottom: 32px;
}

.cookiestoo-banner-message p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #4b5563;
}

/* Categories */
.cookiestoo-categories {
    margin-bottom: 32px;
}

.cookiestoo-category {
    margin-bottom: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.cookiestoo-category:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.cookiestoo-category-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.cookiestoo-checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
}

.cookiestoo-category-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.cookiestoo-checkbox-custom {
    position: relative;
    height: 20px;
    width: 20px;
    background: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cookiestoo-category-checkbox:checked~.cookiestoo-checkbox-custom {
    background: #3b82f6;
    border-color: #3b82f6;
}

.cookiestoo-category-checkbox:checked~.cookiestoo-checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.cookiestoo-category-checkbox:disabled~.cookiestoo-checkbox-custom {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

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

.cookiestoo-required-badge {
    background: #ef4444;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    margin-left: 8px;
}

.cookiestoo-category-description {
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
    margin-left: 32px;
}

/* Action Buttons */
.cookiestoo-banner-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.cookiestoo-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.cookiestoo-btn-primary {
    background: #3b82f6;
    color: white;
}

.cookiestoo-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cookiestoo-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.cookiestoo-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.cookiestoo-btn-accent {
    background: #10b981;
    color: white;
}

.cookiestoo-btn-accent:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cookiestoo-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Save Status */
.cookiestoo-save-status {
    margin-top: 16px;
    padding: 12px 16px;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    text-align: center;
}

.cookiestoo-save-message {
    color: #065f46;
    font-size: 14px;
    font-weight: 500;
}



/* Responsive Design */
@media (max-width: 768px) {
    .cookiestoo-banner-container {
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }

    .cookiestoo-banner-content {
        padding: 20px 16px 24px;
    }

    .cookiestoo-banner-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .cookiestoo-banner-header h3 {
        font-size: 20px;
    }

    .cookiestoo-banner-message {
        margin-bottom: 20px;
    }

    .cookiestoo-categories {
        margin-bottom: 20px;
    }

    .cookiestoo-banner-actions {
        flex-direction: column;
        gap: 8px;
    }

    .cookiestoo-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }

    .cookiestoo-category {
        padding: 12px;
        margin-bottom: 12px;
    }

    .cookiestoo-category-header {
        margin-bottom: 6px;
    }
}

@media (max-width: 480px) {
    .cookiestoo-banner-content {
        padding: 16px 14px 20px;
    }

    .cookiestoo-banner-header {
        margin-bottom: 12px;
    }

    .cookiestoo-banner-header h3 {
        font-size: 18px;
    }

    .cookiestoo-banner-message {
        margin-bottom: 16px;
    }

    .cookiestoo-banner-message p {
        font-size: 14px;
        line-height: 1.5;
    }

    .cookiestoo-categories {
        margin-bottom: 16px;
    }

    .cookiestoo-category {
        padding: 10px;
        margin-bottom: 10px;
    }

    .cookiestoo-category-title {
        font-size: 14px;
    }

    .cookiestoo-category-description {
        font-size: 12px;
        line-height: 1.4;
        margin-left: 32px;
        margin-top: 4px;
    }

    .cookiestoo-required-badge {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* Animation for showing/hiding */
.cookiestoo-banner.show {
    display: block;
}

.cookiestoo-banner.hide {
    animation: cookiestooSlideDown 0.3s ease-in forwards;
}

@keyframes cookiestooSlideDown {
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Loading state */
.cookiestoo-btn.loading {
    position: relative;
    color: transparent;
}

.cookiestoo-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: cookiestooSpin 1s linear infinite;
}

@keyframes cookiestooSpin {
    to {
        transform: rotate(360deg);
    }
}


/* =======================================================================
   CookiesToo - HairColorGPT modal theme overrides
   ======================================================================= */

.cookiestoo-banner-overlay {
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.cookiestoo-banner-container {
    background-image: var(--cookiestoo-modal-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    border-radius: 28px 28px 0 0;
}

.cookiestoo-banner-content {
    position: relative;
    padding: 28px 20px 18px;
    color: #fdfdfd;
}

.cookiestoo-banner-header h3,
.cookiestoo-banner-message,
.cookiestoo-banner-message p,
.cookiestoo-category-title,
.cookiestoo-category-description,
.cookiestoo-banner-subtitle {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    color: #fdfdfd !important;
}

.cookiestoo-banner-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    opacity: 0.9;
}

.cookiestoo-close-btn {
    background: #ffffff;
    border-radius: 9999px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.cookiestoo-close-btn svg path {
    stroke: #111827;
}

.cookiestoo-categories {
    margin-top: 18px;
}

.cookiestoo-category {
    background: #212121;
    border: 1px solid #2f2f2f;
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
}

.cookiestoo-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
}

.cookiestoo-accordion-toggle {
    background: transparent;
    border: 0;
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fdfdfd;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.cookiestoo-category.is-open .cookiestoo-accordion-toggle {
    transform: rotate(180deg);
}

.cookiestoo-category-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cookiestoo-category-title {
    color: #fdfdfd;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cookiestoo-required-badge {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fdfdfd;
}

.cookiestoo-category-description {
    display: none;
    padding: 0 14px 14px;
    color: #fdfdfd;
    opacity: 0.90;
}

.cookiestoo-category.is-open .cookiestoo-category-description {
    display: block;
}

/* Switch (right side) */
.cookiestoo-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cookiestoo-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.cookiestoo-switch-slider {
    width: 46px;
    height: 26px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    transition: all 0.2s ease;
}

.cookiestoo-switch-slider::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    background: #fdfdfd;
    top: 2px;
    left: 2px;
    transition: all 0.2s ease;
}

.cookiestoo-switch input:checked+.cookiestoo-switch-slider {
    background: rgba(16, 185, 129, 0.85);
    border-color: rgba(16, 185, 129, 0.90);
}

.cookiestoo-switch input:checked+.cookiestoo-switch-slider::after {
    transform: translateX(20px);
}

.cookiestoo-switch input:disabled+.cookiestoo-switch-slider {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Buttons */
.cookiestoo-banner-actions {
    background: transparent;
    padding: 14px 0 0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.cookiestoo-btn {
    border-radius: 9999px;
    background: transparent;
    box-shadow: none;
}

.cookiestoo-btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.85);
    color: #fdfdfd;
}

.cookiestoo-btn-primary {
    border: 1px solid rgba(59, 130, 246, 0.90);
    color: #fdfdfd;
}

.cookiestoo-btn-accent {
    background: rgba(16, 185, 129, 0.95);
    border: 1px solid rgba(16, 185, 129, 0.95);
    color: #ffffff;
}

/* Desktop: centered modal instead of full-width sheet */
@media (min-width: 768px) {
    .cookiestoo-banner-container {
        left: 50%;
        right: auto;
        /* Note: translateX(-50%) is combined with translateY in animation states below */
        width: min(1100px, calc(100% - 48px));
        bottom: 24px;
        border-radius: 28px;
        max-height: 85vh;
    }
}

/* Mobile: full width sheet, buttons full-width */
@media (max-width: 767px) {
    .cookiestoo-banner-content {
        padding: 22px 16px 14px;
    }

    .cookiestoo-banner-actions {
        justify-content: space-between;
    }

    .cookiestoo-btn {
        flex: 1;
        text-align: center;
    }
}

/* =======================================================================
   CookiesToo - UI fixes (Round 2)
   Addresses: white hover backgrounds, smoother modal animation,
   lighter overlay, readable chevrons, working accordion, 2-column desktop.
   ======================================================================= */

/* Lighter overlay */
.cookiestoo-banner-overlay {
    background: rgba(0, 0, 0, 0.45) !important;
    opacity: 0;
    transition: opacity 260ms ease;
}

/* Ensure container has no white bg bleeding through + add visible border */
.cookiestoo-banner-container {
    background-color: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.55) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.40), inset 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
    animation: none !important;
    transform: translateY(18px);
    opacity: 0;
    transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 260ms ease;
}

.cookiestoo-banner.show .cookiestoo-banner-overlay {
    opacity: 1;
}

.cookiestoo-banner.show .cookiestoo-banner-container {
    transform: translateY(0);
    opacity: 1;
}

.cookiestoo-banner.hide .cookiestoo-banner-container {
    transform: translateY(28px);
    opacity: 0;
}

/* Desktop: preserve horizontal centering with vertical animation */
@media (min-width: 768px) {
    .cookiestoo-banner-container {
        transform: translateX(-50%) translateY(18px);
    }

    .cookiestoo-banner.show .cookiestoo-banner-container {
        transform: translateX(-50%) translateY(0);
    }

    .cookiestoo-banner.hide .cookiestoo-banner-container {
        transform: translateX(-50%) translateY(28px);
    }
}

/* Prevent any white backgrounds inside the modal footer/actions */
.cookiestoo-banner-actions,
.cookiestoo-banner-content {
    background: transparent !important;
}

/* ===== PROFESSIONAL PANEL DESIGN ===== */

/* Category grid: 2 columns on desktop */
.cookiestoo-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

/* Mobile: single column */
@media (max-width: 600px) {
    .cookiestoo-categories {
        grid-template-columns: 1fr;
    }
}

/* Category card: professional styling */
.cookiestoo-category {
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(30, 30, 30, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: border-color 0.2s ease, transform 0.15s ease;
    display: flex;
    flex-direction: column;
}

.cookiestoo-category:hover {
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.cookiestoo-category--required {
    background: rgba(40, 40, 40, 0.90) !important;
}

/* Category header: title + toggle */
.cookiestoo-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 8px;
}

/* Category info: title + badge */
.cookiestoo-category-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.cookiestoo-category-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
}

/* Required badge */
.cookiestoo-required-badge {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.35);
    color: #4ADE80;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Description: always visible */
.cookiestoo-category-description {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 16px 14px !important;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1.5;
    opacity: 1 !important;
}

/* Switch styling - enhanced */
.cookiestoo-switch {
    flex-shrink: 0;
}

.cookiestoo-switch input[type="checkbox"] {
    width: 44px;
    height: 24px;
}

.cookiestoo-switch-slider {
    width: 44px;
    height: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.15);
    transition: background-color 0.2s ease;
}

.cookiestoo-switch-slider::before {
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.cookiestoo-switch input:checked+.cookiestoo-switch-slider {
    background: #10B981;
}

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

.cookiestoo-switch input:disabled+.cookiestoo-switch-slider {
    background: rgba(74, 222, 128, 0.4);
    cursor: not-allowed;
}

.cookiestoo-switch input:disabled+.cookiestoo-switch-slider::before {
    background: #ffffff;
}

/* Mobile: single column + compact spacing + scrollable categories */
@media (max-width: 767px) {
    .cookiestoo-banner-container {
        border-radius: 24px 24px 0 0 !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        display: flex;
        flex-direction: column;
    }

    .cookiestoo-banner-content {
        display: flex;
        flex-direction: column;
        max-height: calc(90vh - env(safe-area-inset-bottom, 0px));
        max-height: calc(90dvh - env(safe-area-inset-bottom, 0px));
        padding: 20px 16px 16px !important;
        overflow: hidden;
    }

    /* Header stays fixed */
    .cookiestoo-banner-header {
        flex-shrink: 0;
    }

    .cookiestoo-banner-header h3 {
        font-size: 20px !important;
    }

    /* Message more compact */
    .cookiestoo-banner-message {
        flex-shrink: 0;
        margin-bottom: 12px;
    }

    .cookiestoo-banner-message p {
        font-size: 13px !important;
        line-height: 1.45;
    }

    /* Categories scrollable area */
    .cookiestoo-categories {
        flex: 1 1 auto;
        overflow-y: auto;
        max-height: 40vh;
        margin-bottom: 14px;
        padding-right: 4px;
        gap: 10px;
    }

    .cookiestoo-category {
        border-radius: 12px;
    }

    .cookiestoo-category-header {
        padding: 12px 14px 6px !important;
    }

    .cookiestoo-category-title {
        font-size: 13px;
    }

    .cookiestoo-category-description {
        padding: 0 14px 12px !important;
        font-size: 11px;
        line-height: 1.4;
    }

    .cookiestoo-required-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    /* Buttons stay at bottom */
    .cookiestoo-banner-actions {
        flex-shrink: 0;
        flex-direction: column;
        padding: 12px 0 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        gap: 10px;
    }

    .cookiestoo-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px !important;
        font-size: 14px !important;
    }

    /* Smaller toggle on mobile */
    .cookiestoo-switch-slider {
        width: 42px;
        height: 24px;
    }

    .cookiestoo-switch-slider::after {
        width: 18px;
        height: 18px;
    }

    .cookiestoo-switch input:checked+.cookiestoo-switch-slider::after {
        transform: translateX(18px);
    }
}