/*
 * Django port only: CSS for the parts MudBlazor did in JS (popovers, tooltips, dialogs, snackbar),
 * plus the cookie banner styles (copied from CookieBanner.razor.css, which was CSS-isolated).
 */

[hidden] {
    display: none !important;
}

/* Popovers are placed by CSS below their anchor, which needs position: relative */
.cornea-popover-anchor {
    position: relative;
}

.mud-popover.mud-popover-open.cornea-popover-below-left {
    top: 100%;
    left: 0;
}

.mud-popover.mud-popover-open.cornea-popover-below-center {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
}

/* MudTooltip: text in data-tooltip, shown above (default) or below (data-placement="bottom") */
.cornea-tooltip {
    position: relative;
}

.cornea-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 300px;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 12px;
    line-height: 1.4em;
    text-align: center;
    border-radius: var(--mud-default-borderradius);
    color: var(--mud-palette-dark-text);
    background-color: var(--mud-palette-gray-darker);
    z-index: var(--mud-zindex-tooltip);
    pointer-events: none;
}

.cornea-tooltip:not([data-placement="bottom"]):hover::after {
    bottom: calc(100% + 8px);
}

.cornea-tooltip[data-placement="bottom"]:hover::after {
    top: calc(100% + 8px);
}

/* MudCheckBox: both icons are rendered, the checked state picks one */
.mud-checkbox-input:not(:checked) ~ .cornea-checkbox-checked,
.mud-checkbox-input:checked ~ .cornea-checkbox-unchecked {
    display: none;
}

/* MudSelect as a native <select>: the arrow is drawn by the adornment. MudBlazor's and app.css's rules
   for the value slot only match div/input, so they are repeated here, with vertical padding for the height */
.cornea-native-select {
    appearance: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    display: block;
    box-sizing: content-box;
    width: 100%;
    min-width: 0;
    height: 1lh;
    margin: 0;
    padding: 16px 2rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: transparent;
    border: 0;
    outline: 0;
}

.cornea-native-select option {
    color: var(--mud-palette-text-primary);
    background-color: #1a1d26;
}

.cornea-select-arrow {
    pointer-events: none;
}

/* Where the browser allows styling the option list (customizable select), it looks like MudSelect's
   popover (app.css .cornea-select-item); elsewhere the native list stays */
@supports (appearance: base-select) {
    .cornea-native-select,
    .cornea-native-select::picker(select) {
        appearance: base-select;
    }

    .cornea-native-select::picker-icon,
    .cornea-native-select option::checkmark {
        display: none;
    }

    .cornea-native-select::picker(select) {
        margin-top: 4px;
        padding: 8px 0;
        border: 0;
        border-radius: 15px;
        background-color: #1a1d26;
        box-shadow: var(--mud-elevation-8);
    }

    .cornea-native-select option {
        padding: 8px 16px 8px 2rem;
        color: #735a86;
    }

    .cornea-native-select option:hover,
    .cornea-native-select option:focus-visible {
        background-color: #3a3747;
    }

    .cornea-native-select option:checked {
        color: #d9cdff;
    }
}

/* MudExpansionPanel as <details> */
summary.mud-expand-panel-header {
    list-style: none;
}

summary.mud-expand-panel-header::-webkit-details-marker {
    display: none;
}

/* Menu items can be links or form buttons */
a.mud-menu-item,
button.mud-menu-item {
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: start;
    text-decoration: none;
    background: none;
    border: 0;
}

.mud-snackbar {
    transition: opacity 0.5s;
}

.mud-snackbar.cornea-snackbar-hiding {
    opacity: 0;
}

.consent-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    padding: 24px;
    transform: translateY(calc(100% + 32px));
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease-in-out;
}

.consent-notice.slide-in {
    transform: translateY(0);
    opacity: 1;
}

.consent-notice-content {
    max-width: 1200px;
    margin: 0 auto;
    border: 2px solid var(--mud-palette-primary);
    border-radius: 12px;
    box-shadow: 0px 8px 24px rgba(104, 48, 186, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .consent-notice {
        padding: 12px;
    }

    .consent-notice-content {
        border-radius: 8px;
    }

    /* Force vertical stacking on mobile */
    .consent-notice .mud-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Full width button on mobile */
    .consent-notice .mud-button-root {
        width: 100%;
        margin-top: 8px;
    }

    /* Adjust icon size on mobile */
    .consent-notice .mud-icon-root {
        font-size: 1.75rem;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .consent-notice-content {
        max-width: 95%;
    }

    .consent-notice {
        padding: 20px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .consent-notice {
        padding: 24px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .consent-notice {
        transition: opacity 0.2s ease-in-out;
    }

    .consent-notice.slide-in {
        transform: translateY(0);
    }
}
