/*
 * Html Inputs Styles
 *
 * Default styling for the IwWpUtils Html Inputs component.
 *
 * @package     iw-wp-utils
 * @subpackage  assets/style/HtmlInputs
 * @since       1.0.0
 -------------------------------------------------------------- */

/* iw Datepicker by jQuery datepicker */
/* Date Picker Tigger */
.iw_contact_form input.wpcf7-date ~ img.ui-datepicker-trigger {
    width: 20px;
    position: absolute;
    top: 17px;
    right: 17px;
}

/* The legacy icon is reachable by keyboard (HtmlInputs.js); show where the focus is. */
.iw_contact_form input.wpcf7-date ~ img.ui-datepicker-trigger {
    cursor: pointer;
}

.iw-date-field ~ .ui-datepicker-trigger:focus-visible {
    outline: 2px solid #ef17ef;
    outline-offset: 2px;
}

/* Calendar on request (data-iw-date="calendar"): the trigger is a real button with the icon inside.
   Structure only; where it sits is the theme's call. */
.iw-date-field--calendar ~ button.ui-datepicker-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    line-height: 0;
    cursor: pointer;
}

.iw-date-field--calendar ~ button.ui-datepicker-trigger img {
    width: 20px;
    height: 20px;
}

/* Month and year choice (data-iw-date-change-month / -change-year), an IwWpUtilsSelect each */
.iw-datepicker .ui-datepicker-title select,
.iw-datepicker .ui-datepicker-title .iw-select {
    margin: 0 4px;
    font: inherit;
}

/*
 * Select with a styleable list (IwWpUtilsSelect, data-iw-select). A plain look in the page's
 * colours and the system's highlight; themes restyle .iw-select__button, __list and __option.
 */
.iw-select {
    position: relative;
    display: inline-block;
    max-width: 100%;
    vertical-align: middle;
}

/* The native select stays in the form and under the replacement, for the browser's hints. */
.iw-select .iw-select__native {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.iw-select__button {
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: 2em;
    padding: 0 8px;
    border: 1px solid;
    background-color: Canvas;
    color: CanvasText;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

/* Chevron (keyboard_arrow_down) down while closed, turned up while open */
.iw-select__chevron {
    display: inline-flex;
    flex: none;
    margin-left: auto;
    transition: transform 200ms;
}

.iw-select__chevron svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.iw-select--open .iw-select__chevron {
    transform: rotate(180deg);
}

/* Without the icon from the params: a drawn chevron */
.iw-select__chevron:empty::before {
    content: "";
    width: 0.4em;
    height: 0.4em;
    margin: 0 0.2em;
    border-right: 2px solid;
    border-bottom: 2px solid;
    transform: translateY(-25%) rotate(45deg);
}

@media (prefers-reduced-motion: reduce) {
    .iw-select__chevron {
        transition: none;
    }
}

.iw-select__button:focus-visible {
    outline: 2px solid;
    outline-offset: 2px;
}

.iw-select--disabled .iw-select__button {
    opacity: 0.5;
    cursor: default;
}

.iw-select__value {
    overflow: hidden;
    text-overflow: ellipsis;
}

.iw-select__list {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    display: block;
    box-sizing: border-box;
    min-width: 100%;
    max-height: 264px;
    margin-top: 4px;
    padding: 4px 0;
    overflow-y: auto;
    border: 1px solid;
    background-color: Canvas;
    color: CanvasText;
}

.iw-select__list[hidden] {
    display: none;
}

.iw-select--up .iw-select__list {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.iw-select__option,
.iw-select__group-label {
    display: block;
    padding: 4px 12px;
    white-space: nowrap;
}

.iw-select__option {
    cursor: pointer;
}

.iw-select__group-label {
    font-weight: 700;
}

.iw-select__group .iw-select__option {
    padding-left: 24px;
}

.iw-select__option[aria-selected="true"] {
    font-weight: 700;
}

.iw-select__option--active {
    background-color: Highlight;
    color: HighlightText;
}

.iw-select__option[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

/* Date Picker (Calendar) Container */
.iw-datepicker {
    background-color: #17efef;
    margin: 0;
    padding: 17px;
    border: 1px solid #efef17;
    min-width: 300px;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 998;
}

/* Prev and Next Buttons */
.iw-datepicker .ui-datepicker-prev,
.iw-datepicker .ui-datepicker-next {
    cursor: pointer;
}

.iw-datepicker .ui-datepicker-next {
    float: right;
}

.iw-datepicker .ui-datepicker-prev.ui-state-disabled,
.iw-datepicker .ui-datepicker-next.ui-state-disabled {
    visibility: hidden;
}

/* Month and Year Title */
.iw-datepicker .ui-datepicker-title {
    padding: 17px;
}

/* Calendar Table */
.iw-datepicker table.ui-datepicker-calendar {
    width: 100%;
}

.iw-datepicker table.ui-datepicker-calendar td {
    text-align: center;
}

.iw-datepicker table.ui-datepicker-calendar td.ui-datepicker-unselectable {
    color: #CCCCCC;
}

.iw-datepicker table.ui-datepicker-calendar a {
    text-decoration: none;
    cursor: pointer;
    color: #ef17ef;
}

.iw-datepicker table.ui-datepicker-calendar a:hover,
.iw-datepicker table.ui-datepicker-calendar a:focus {
    text-decoration: underline;
    color: #ef17ef;
}

/* iw File Drop (CF7 file field with class:iw-file-drop, HtmlInputs.js)
   Structure only, in the placeholder colours of this sheet: the theme gives it its look. */
.iw-file-drop-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 25px;
    text-align: center;
    background-color: #17efef;
    border: 2px dashed #ef17ef;
}

/* The native input covers the whole area, invisible: click and drop land on it. */
.iw-file-drop-zone input.wpcf7-file {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.iw-file-drop-zone:focus-within {
    outline: 2px solid #ef17ef;
    outline-offset: 2px;
}

.iw-file-drop-zone.is-dragover {
    background-color: #efef17;
}

.iw-file-drop-icon,
.iw-file-drop-file-icon,
.iw-file-drop-remove {
    display: inline-flex;
    line-height: 0;
}

.iw-file-drop-icon svg {
    width: 32px;
    height: 32px;
    fill: #ef17ef;
}

.iw-file-drop-choose {
    color: #ef17ef;
}

.iw-file-drop-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.iw-file-drop-list:empty {
    display: none;
}

.iw-file-drop-file {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 15px;
    background-color: #17efef;
}

.iw-file-drop-file-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.iw-file-drop-file-icon svg,
.iw-file-drop-remove svg {
    width: 24px;
    height: 24px;
    fill: #ef17ef;
}

.iw-file-drop-notice {
    display: block;
    color: #ef17ef;
}

.iw-file-drop-notice:empty {
    display: none;
}

.iw-file-drop-remove {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
