/* NSEMM Cookie Consent - Clean CSS Using Theme Styles */
/* Leverages existing theme variables and classes */

/* =================================================================
   COOKIE BANNER - USES EXISTING THEME SYSTEM
================================================================= */

.nsemm-cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999999;
    max-width: 420px;
    width: calc(100vw - 40px);
    font-family: inherit; /* Uses theme's Readex Pro */
    transform: translateY(100px);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, bottom 0.3s ease;
    pointer-events: none;
}

/* DEBUG: Force banner to be visible when show class is added */
.nsemm-cookie-banner.show {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: all !important;
    max-width: 420px !important;
}


/* Suspended positioning for front page */
.nsemm-cookie-banner.suspended {
    bottom: 100px;
}

.nsemm-cookie-banner.suspended.scrolled {
    bottom: 20px;
}

/* Default state - fully opaque */
.nsemm-cookie-banner:not(.minified) {
    opacity: 1 !important;
}

/* Minified state - auto-minification after scrolling */
.nsemm-cookie-banner.minified {
    opacity: 0.85;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, bottom 0.3s ease;
}

.nsemm-cookie-banner.minified:hover {
    opacity: 1;
    transform: scale(1);
}

/* Normal state transitions for content */
.nsemm-cookie-message,
.nsemm-cookie-actions {
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

/* Hide content when minified except header */
.nsemm-cookie-banner.minified .nsemm-cookie-message {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0;
}

.nsemm-cookie-banner.minified .nsemm-cookie-actions {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0;
}

/* Show expand button in minified state */
.nsemm-cookie-banner.minified .nsemm-cookie-expand {
    display: flex !important;
    opacity: 0.7;
}

/* Ensure normal state shows content */
.nsemm-cookie-banner:not(.minified) .nsemm-cookie-message,
.nsemm-cookie-banner:not(.minified) .nsemm-cookie-actions {
    max-height: 500px;
    opacity: 1;
}



.nsemm-cookie-content {
    background: rgba(255, 255, 255, 0.25); /* Apple-style frosted glass base */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--spacing-lg, 24px); /* Uses theme's 24px */
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18); /* Subtle glass border */
    overflow: hidden;
    position: relative;
}

/* Add university blue tint overlay for theme colors */
.nsemm-cookie-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(28, 59, 112, 0.4) 0%, rgba(28, 59, 112, 0.2) 100%);
    border-radius: var(--spacing-lg, 24px);
    pointer-events: none;
    z-index: -1;
}

/* Enhanced frosted glass when not minified */
.nsemm-cookie-banner:not(.minified) .nsemm-cookie-content {
    background: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(25px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(200%) !important;
}

.nsemm-cookie-banner:not(.minified) .nsemm-cookie-content::before {
    background: linear-gradient(135deg, rgba(28, 59, 112, 0.5) 0%, rgba(28, 59, 112, 0.3) 100%) !important;
}

/* =================================================================
   BANNER COMPONENTS - THEME SPACING
================================================================= */

.nsemm-cookie-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg, 24px) var(--spacing-lg, 24px) var(--spacing-md, 16px);
    background: linear-gradient(135deg, rgba(250, 205, 0, 0.2) 0%, rgba(250, 205, 0, 0.1) 100%);
    position: relative;
}

.nsemm-cookie-title {
    font-family: 'Sora', sans-serif; /* Theme heading font */
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--university-blue, #1C3B70); /* Default dark text for minified state */
    margin: 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    height: 100%;
}

/* White text when not minified (blue background) */
.nsemm-cookie-banner:not(.minified) .nsemm-cookie-title {
    color: white !important;
}


/* Expand button - hidden by default, shown when minified */
.nsemm-cookie-expand {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--university-blue, #1C3B70); /* Default dark text for minified state */
    cursor: pointer;
    padding: var(--spacing-xs, 4px);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: none !important;
    opacity: 0.7;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nsemm-cookie-expand:hover {
    background: rgba(28, 59, 112, 0.1);
    opacity: 1;
    transform: rotate(45deg);
}

.nsemm-cookie-expand:focus {
    outline: 3px solid var(--knowledge-gold, #FACD00);
    outline-offset: 2px;
}

.nsemm-cookie-message {
    padding: var(--spacing-md, 16px) var(--spacing-lg, 24px) var(--spacing-lg, 24px);
}

.nsemm-cookie-message p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--midnight, #2B2A2A); /* Default dark text for minified state */
    margin: 0;
}

/* White text when not minified (blue background) */
.nsemm-cookie-banner:not(.minified) .nsemm-cookie-message p {
    color: white !important;
}

.nsemm-cookie-actions {
    padding: var(--spacing-md, 16px) var(--spacing-lg, 24px) var(--spacing-lg, 24px);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 8px);
}

/* =================================================================
   BUTTONS - THEME BUTTON STYLES
================================================================= */

.nsemm-cookie-btn {
    padding: var(--spacing-md, 16px) var(--spacing-lg, 24px);
    border-radius: 25px; /* Matches theme button style */
    border: 2px solid transparent;
    font-family: 'Sora', sans-serif; /* Theme heading font */
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease; /* Theme transition */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs, 4px);
}

/* Accept All - Primary Button */
.nsemm-btn-accept-all {
    background: var(--knowledge-gold, #FACD00); /* Theme primary */
    color: var(--foundational-brown, #443800);
    border-color: var(--knowledge-gold, #FACD00);
    box-shadow: 0 4px 15px rgba(250, 205, 0, 0.3);
}

.nsemm-btn-accept-all:hover {
    background: var(--university-blue, #1C3B70); /* Theme secondary */
    border-color: var(--university-blue, #1C3B70);
    color: white;
    transform: translateY(-2px); /* Theme hover effect */
    box-shadow: 0 6px 20px rgba(28, 59, 112, 0.4);
}

/* Customise - Secondary Button */
.nsemm-btn-customise {
    background: white;
    color: var(--university-blue, #1C3B70);
    border-color: var(--university-blue, #1C3B70);
}

.nsemm-btn-customise:hover {
    background: var(--university-blue, #1C3B70);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(28, 59, 112, 0.3);
}

/* Decline - Minimal Button */
.nsemm-btn-decline {
    background: transparent;
    color: var(--inspiration-pink, #FA00CD); /* Theme accent */
    border: none;
    font-size: 0.85rem;
    padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
}

.nsemm-btn-decline:hover {
    background: rgba(250, 0, 205, 0.1);
    color: var(--inspiration-pink, #FA00CD);
}

/* =================================================================
   COOKIE SETTINGS PAGE - USES THEME LAYOUT
================================================================= */

.nsemm-cookie-settings-page {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-xl, 32px);
}

.nsemm-cookie-settings-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl, 48px);
    padding: var(--spacing-xl, 32px);
    background: linear-gradient(135deg, var(--coastal-green, #D9FFEC) 0%, rgba(217, 255, 236, 0.3) 100%);
    border-radius: var(--spacing-lg, 24px);
    border: 2px solid var(--knowledge-gold, #FACD00);
}

.nsemm-cookie-settings-header h2 {
    font-family: 'Sora', sans-serif; /* Theme heading */
    font-size: 2.5rem;
    color: var(--university-blue, #1C3B70);
    margin-bottom: var(--spacing-md, 16px);
}

.nsemm-cookie-settings-header p {
    font-size: 1.1rem;
    color: var(--midnight, #2B2A2A);
    margin: 0;
    max-width: 600px;
    margin: 0 auto;
}

/* =================================================================
   TOGGLE SWITCHES - STANDARD IMPLEMENTATION
================================================================= */

.nsemm-cookie-category {
    background: white;
    border-radius: var(--spacing-md, 16px);
    margin-bottom: var(--spacing-lg, 24px);
    padding: var(--spacing-lg, 24px);
    border: 2px solid var(--coastal-green, #D9FFEC);
    transition: all 0.3s ease;
}

.nsemm-cookie-category:hover {
    transform: translateY(-2px); /* Theme hover */
    box-shadow: 0 8px 25px rgba(28, 59, 112, 0.1);
    border-color: var(--knowledge-gold, #FACD00);
}

.nsemm-cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md, 16px);
}

.nsemm-cookie-category h3 {
    font-family: 'Sora', sans-serif; /* Theme heading */
    font-size: 1.3rem;
    color: var(--university-blue, #1C3B70);
    margin: 0;
    font-weight: 600;
}

.nsemm-cookie-description {
    color: var(--midnight, #2B2A2A);
    line-height: 1.6;
    margin: 0;
    font-size: 0.95rem;
}

/* WORKING TOGGLE SWITCH */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

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

input:checked + .slider {
    background-color: var(--knowledge-gold, #FACD00); /* Theme primary */
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--knowledge-gold, #FACD00);
}

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

/* Disabled state for necessary cookies */
input:disabled + .slider {
    background-color: var(--soft-mint, #8BD6AC); /* Theme green */
    cursor: not-allowed;
}

input:disabled + .slider:before {
    background-color: var(--university-blue, #1C3B70); /* Theme blue */
}

/* =================================================================
   FORM ACTIONS - THEME BUTTON SYSTEM
================================================================= */

.nsemm-cookie-form .nsemm-cookie-actions {
    margin-top: var(--spacing-xl, 32px);
    padding: var(--spacing-xl, 32px);
    background: linear-gradient(135deg, rgba(250, 205, 0, 0.1) 0%, rgba(28, 59, 112, 0.05) 100%);
    border-radius: var(--spacing-md, 16px);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 16px);
}

/* Page-specific buttons using theme colors */
.nsemm-btn-save {
    background: var(--knowledge-gold, #FACD00);
    color: var(--foundational-brown, #443800);
    border-color: var(--knowledge-gold, #FACD00);
    font-size: 1rem;
    padding: var(--spacing-lg, 24px) var(--spacing-xl, 32px);
}

.nsemm-btn-save:hover {
    background: var(--university-blue, #1C3B70);
    color: white;
    border-color: var(--university-blue, #1C3B70);
}

.nsemm-btn-accept-all-page {
    background: var(--soft-mint, #8BD6AC);
    color: var(--university-blue, #1C3B70);
    border-color: var(--soft-mint, #8BD6AC);
}

.nsemm-btn-accept-all-page:hover {
    background: var(--discovery-teal, #00FACD);
    color: white;
    border-color: var(--discovery-teal, #00FACD);
}

.nsemm-btn-decline-all {
    background: transparent;
    color: var(--inspiration-pink, #FA00CD);
    border-color: var(--inspiration-pink, #FA00CD);
    font-size: 0.9rem;
}

.nsemm-btn-decline-all:hover {
    background: var(--inspiration-pink, #FA00CD);
    color: white;
}

/* =================================================================
   INFO SECTION - THEME STYLING
================================================================= */

.nsemm-cookie-info {
    margin-top: var(--spacing-2xl, 48px);
    padding: var(--spacing-xl, 32px);
    background: rgba(174, 188, 212, 0.1);
    border-radius: var(--spacing-md, 16px);
    border-left: 5px solid var(--serenity-slate, #AEBCD4); /* Theme color */
}

.nsemm-cookie-info h3 {
    font-family: 'Sora', sans-serif;
    color: var(--university-blue, #1C3B70);
    margin-bottom: var(--spacing-md, 16px);
}

.nsemm-cookie-info a {
    color: var(--university-blue, #1C3B70);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid var(--knowledge-gold, #FACD00);
    transition: all 0.3s ease;
}

.nsemm-cookie-info a:hover {
    color: var(--inspiration-pink, #FA00CD); /* Theme hover */
    border-bottom-color: var(--inspiration-pink, #FA00CD);
}

/* =================================================================
   LOADING & SUCCESS STATES
================================================================= */

.nsemm-cookie-loading {
    position: relative;
    pointer-events: none;
}

.nsemm-cookie-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--knowledge-gold, #FACD00);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite; /* Use theme animation */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.nsemm-cookie-success {
    background: var(--soft-mint, #8BD6AC) !important;
    color: var(--university-blue, #1C3B70) !important;
    border-color: var(--soft-mint, #8BD6AC) !important;
}

.nsemm-cookie-success::before {
    content: '✓ ';
}

/* =================================================================
   RESPONSIVE - USES THEME BREAKPOINTS
================================================================= */

/* Tablet */
@media (max-width: 768px) {
    .nsemm-cookie-banner {
        left: 10px;
        right: 10px;
        max-width: none;
        width: calc(100vw - 20px);
    }

    .nsemm-cookie-banner.suspended {
        bottom: 80px;
    }

    .nsemm-cookie-settings-page {
        padding: var(--spacing-lg, 24px); /* Theme spacing */
    }

    .nsemm-cookie-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md, 16px);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .nsemm-cookie-banner {
        left: 5px;
        right: 5px;
        width: calc(100vw - 10px);
    }

    .nsemm-cookie-banner.suspended {
        bottom: 60px;
    }

    .nsemm-cookie-header {
        padding: var(--spacing-md, 16px);
    }

    .nsemm-cookie-message {
        padding: 0 var(--spacing-md, 16px) var(--spacing-md, 16px);
    }

    .nsemm-cookie-actions {
        padding: var(--spacing-md, 16px);
    }

    .nsemm-cookie-btn {
        font-size: 0.85rem;
        padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
    }

    .nsemm-cookie-settings-page {
        padding: var(--spacing-md, 16px);
    }

    .nsemm-cookie-category {
        padding: var(--spacing-md, 16px);
    }
}

/* =================================================================
   ACCESSIBILITY - THEME FOCUS STYLES
================================================================= */

.nsemm-cookie-btn:focus,
.switch:focus-within {
    outline: 3px solid var(--knowledge-gold, #FACD00); /* Theme focus */
    outline-offset: 2px;
}

.switch input:focus + .slider {
    box-shadow: 0 0 0 3px var(--knowledge-gold, #FACD00);
}

/* High contrast support */
@media (prefers-contrast: high) {
    .nsemm-cookie-content {
        border-width: 4px;
    }

    .nsemm-cookie-btn {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nsemm-cookie-banner,
    .nsemm-cookie-btn,
    .nsemm-cookie-category {
        transition: none !important;
        animation: none !important;
    }
}

/* Print support */
@media print {
    .nsemm-cookie-banner {
        display: none !important;
    }
}