/**
 * LVCE aviation template - forms, Joomla core component classes,
 * system messages, pagination and tables.
 *
 * Joomla's own components (contact form, login, search, registration)
 * output Bootstrap-style class names. The template styles those names
 * directly, so the Bootstrap CSS file is not needed on the front end.
 */

/* ---------------------------------------------------------------------------
 * Form layout
 * ------------------------------------------------------------------------- */
form {
    margin: 0;
}

fieldset {
    min-width: 0;
    margin: 0 0 var(--lvce-space-5);
    padding: 0;
    border: 0;
}

legend {
    margin-bottom: var(--lvce-space-3);
    padding: 0;
    font-family: var(--lvce-font-heading);
    font-size: var(--lvce-text-lg);
    font-weight: 700;
    color: var(--lvce-heading);
}

label,
.form-label,
.control-label label {
    display: inline-block;
    margin-bottom: var(--lvce-space-1);
    font-weight: 600;
    color: var(--lvce-heading);
}

.control-group,
.mb-3,
.lvce-form__field,
.form-group {
    margin-bottom: var(--lvce-space-4);
}

.controls {
    min-width: 0;
}

.star,
.required-star {
    color: var(--lvce-red);
}

/* ---------------------------------------------------------------------------
 * Controls
 * ------------------------------------------------------------------------- */
.form-control,
.form-select,
.inputbox,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    display: block;
    width: 100%;
    min-height: var(--lvce-touch);
    padding: 0.6em 0.85em;
    border: 1.5px solid color-mix(in srgb, var(--lvce-text-muted) 60%, var(--lvce-border));
    border-radius: var(--lvce-radius-small);
    background-color: var(--lvce-card-bg);
    color: var(--lvce-text);
    font-size: max(16px, var(--lvce-text-base));
    line-height: 1.4;
    transition: border-color var(--lvce-transition), box-shadow var(--lvce-transition);
    appearance: none;
}

textarea {
    min-height: 8rem;
    resize: vertical;
}

select,
.form-select {
    padding-inline-end: 2.5rem;
    background-image: var(--lvce-select-arrow);
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1rem;
}

select[multiple],
select[size]:not([size="1"]) {
    background-image: none;
    padding-inline-end: 0.85em;
}

.form-control:hover,
input:hover,
select:hover,
textarea:hover {
    border-color: var(--lvce-blue);
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--lvce-blue);
    outline: 3px solid var(--lvce-focus);
    outline-offset: 1px;
}

::placeholder {
    color: var(--lvce-text-muted);
    opacity: 1;
}

input[disabled],
select[disabled],
textarea[disabled],
.form-control[readonly] {
    background: var(--lvce-bg-alt);
    cursor: not-allowed;
}

/* Checkboxes and radios */
input[type="checkbox"],
input[type="radio"],
.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0.15em 0 0;
    accent-color: var(--lvce-blue);
    vertical-align: top;
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: var(--lvce-space-2);
    min-height: var(--lvce-touch);
    margin-bottom: var(--lvce-space-2);
}

.form-check-label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

/* Validation feedback (Joomla form validator adds .invalid / aria-invalid) */
.invalid,
input.invalid,
textarea.invalid,
select.invalid,
[aria-invalid="true"] {
    border-color: var(--lvce-red) !important;
    background-image: none;
}

label.invalid,
.invalid-feedback,
.form-control-feedback {
    color: var(--lvce-danger-text);
    font-weight: 600;
}

.form-control-feedback::before,
.invalid-feedback::before {
    content: "! ";
}

.form-text,
.small.text-muted,
.form-control-feedback + .form-text {
    display: block;
    margin-top: var(--lvce-space-1);
    font-size: var(--lvce-text-sm);
    color: var(--lvce-text-muted);
}

.input-group {
    display: flex;
    align-items: stretch;
    gap: var(--lvce-space-2);
    flex-wrap: wrap;
}

.input-group > .form-control {
    flex: 1 1 12rem;
    width: auto;
}

/* ---------------------------------------------------------------------------
 * Joomla / Bootstrap-style buttons
 * ------------------------------------------------------------------------- */
.btn,
button[type="submit"]:not([class*="lvce-"]),
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: var(--lvce-touch);
    padding: 0.6em 1.25em;
    border: 2px solid var(--lvce-blue);
    border-radius: 999px;
    background: var(--lvce-blue);
    color: #ffffff;
    font-family: var(--lvce-font-heading);
    font-size: var(--lvce-text-sm);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--lvce-transition), border-color var(--lvce-transition), color var(--lvce-transition);
}

.btn:hover,
button[type="submit"]:not([class*="lvce-"]):hover,
input[type="submit"]:hover {
    background: var(--lvce-blue-dark);
    border-color: var(--lvce-blue-dark);
    color: #ffffff;
}

.btn-secondary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-light {
    background: transparent;
    color: var(--lvce-link);
    border-color: currentColor;
}

.btn-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-light:hover {
    background: var(--lvce-blue);
    border-color: var(--lvce-blue);
    color: #ffffff;
}

.btn-danger {
    background: var(--lvce-red);
    border-color: var(--lvce-red);
}

.btn-success {
    background: var(--lvce-success);
    border-color: var(--lvce-success);
}

.btn-sm {
    min-height: 2.25rem;
    padding: 0.35em 0.9em;
    font-size: var(--lvce-text-xs);
}

.btn-link {
    border-color: transparent;
    background: transparent;
    color: var(--lvce-link);
    text-decoration: underline;
}

.w-100 {
    width: 100%;
}

/* ---------------------------------------------------------------------------
 * System messages (joomla-alert web component) and Bootstrap-style alerts
 * ------------------------------------------------------------------------- */
#system-message-container:not(:empty) {
    margin-bottom: var(--lvce-space-5);
}

joomla-alert,
.alert {
    position: relative;
    display: block;
    margin-bottom: var(--lvce-space-4);
    padding: var(--lvce-space-4) var(--lvce-space-7) var(--lvce-space-4) var(--lvce-space-5);
    border: 1px solid var(--lvce-border);
    border-inline-start: 5px solid var(--lvce-blue);
    border-radius: var(--lvce-radius-small);
    background: var(--lvce-bg-sky);
    color: var(--lvce-text);
}

joomla-alert[type="success"],
.alert-success {
    border-inline-start-color: var(--lvce-success);
    background: color-mix(in srgb, var(--lvce-success) 10%, var(--lvce-card-bg));
}

joomla-alert[type="warning"],
.alert-warning {
    border-inline-start-color: var(--lvce-warning);
    background: color-mix(in srgb, var(--lvce-warning) 12%, var(--lvce-card-bg));
}

joomla-alert[type="danger"],
.alert-danger,
.alert-error {
    border-inline-start-color: var(--lvce-red);
    background: color-mix(in srgb, var(--lvce-red) 9%, var(--lvce-card-bg));
}

.alert-heading {
    margin: 0 0 var(--lvce-space-1);
    font-family: var(--lvce-font-heading);
    font-size: var(--lvce-text-base);
    font-weight: 700;
}

.alert-message,
.alert-wrapper > div {
    margin: 0;
}

.joomla-alert--close,
.joomla-alert-button--close,
.alert .btn-close {
    position: absolute;
    top: var(--lvce-space-2);
    inset-inline-end: var(--lvce-space-2);
    width: var(--lvce-touch);
    height: var(--lvce-touch);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--lvce-text);
    font-size: 1.5rem;
    line-height: 1;
}

.joomla-alert--close:hover,
.alert .btn-close:hover {
    background: color-mix(in srgb, currentColor 10%, transparent);
}

/* ---------------------------------------------------------------------------
 * Pagination (Joomla core markup inside .lvce-pagination)
 * ------------------------------------------------------------------------- */
.lvce-pagination {
    display: grid;
    justify-items: center;
    gap: var(--lvce-space-3);
    margin-top: var(--lvce-space-7);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--lvce-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination li,
.page-item {
    margin: 0;
}

.page-link,
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--lvce-touch);
    min-height: var(--lvce-touch);
    padding: 0 0.8em;
    border: 1px solid var(--lvce-border);
    border-radius: 999px;
    background: var(--lvce-card-bg);
    color: var(--lvce-link);
    font-weight: 600;
    text-decoration: none;
}

.page-link:hover,
.pagination a:hover {
    border-color: var(--lvce-blue);
    background: var(--lvce-bg-sky);
}

.page-item.active .page-link,
.pagination .active > span,
.pagination [aria-current="page"],
.pagination [aria-current="true"] {
    border-color: var(--lvce-blue);
    background: var(--lvce-blue);
    color: #ffffff;
}

.page-item.disabled .page-link {
    color: var(--lvce-text-muted);
    background: var(--lvce-bg-alt);
    pointer-events: none;
}

.pagination [class^="icon-"],
.pagination [class*=" icon-"] {
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("../images/icons/chevron-right.svg") center / contain no-repeat;
    mask: url("../images/icons/chevron-right.svg") center / contain no-repeat;
}

.pagination .icon-angle-left,
.pagination .icon-angle-double-left,
.pagination .icon-chevron-left {
    -webkit-mask-image: url("../images/icons/chevron-left.svg");
    mask-image: url("../images/icons/chevron-left.svg");
}

.lvce-pagination__counter {
    margin: 0;
    font-size: var(--lvce-text-sm);
    color: var(--lvce-text-muted);
}

/* ---------------------------------------------------------------------------
 * Tables
 * ------------------------------------------------------------------------- */
.table {
    width: 100%;
    margin-bottom: var(--lvce-space-5);
    font-size: var(--lvce-text-sm);
}

.table th,
.table td {
    padding: var(--lvce-space-3);
    border-bottom: 1px solid var(--lvce-border);
    text-align: start;
    vertical-align: top;
}

.table thead th {
    background: var(--lvce-bg-alt);
    font-weight: 700;
    color: var(--lvce-heading);
}

.table-striped tbody tr:nth-child(odd) {
    background: color-mix(in srgb, var(--lvce-bg-alt) 60%, transparent);
}

.table-responsive {
    overflow-x: auto;
}

/* ---------------------------------------------------------------------------
 * Joomla component helpers (contact, users, smart search)
 * ------------------------------------------------------------------------- */
.com-contact__form,
.com-users-login,
.com-users-registration,
.com-users-reset,
.com-users-remind,
.com-users-profile__edit {
    max-width: 40rem;
}

.com-contact__container {
    display: grid;
    gap: var(--lvce-space-6);
}

.com-contact__address,
.com-contact__miscinfo {
    padding: var(--lvce-space-5);
    border-radius: var(--lvce-radius-medium);
    background: var(--lvce-bg-alt);
}

.com-contact .contact-address dd,
.com-contact .contact-address dt {
    margin: 0;
}

.com-users-login__options {
    display: grid;
    gap: var(--lvce-space-1);
    margin-top: var(--lvce-space-4);
    padding: 0;
    list-style: none;
}

/* Smart search / search module */
.mod-finder,
.mod-finder__search {
    display: flex;
    flex-wrap: wrap;
    gap: var(--lvce-space-2);
}

.mod-finder .awesomplete,
.mod-finder__search .awesomplete {
    flex: 1 1 14rem;
}

.awesomplete > ul {
    border-radius: var(--lvce-radius-small);
    background: var(--lvce-card-bg);
    border: 1px solid var(--lvce-border);
    box-shadow: var(--lvce-shadow);
}

.com-finder__results-list {
    padding: 0;
    list-style: none;
}

.com-finder__results-list li {
    padding: var(--lvce-space-4) 0;
    border-bottom: 1px solid var(--lvce-border);
}

/* Login module */
.mod-login {
    display: grid;
    gap: var(--lvce-space-2);
}

.mod-login__options {
    padding: 0;
    list-style: none;
}

/* Core icon font classes are not loaded on the front end; hide empty glyphs */
/* :where() keeps specificity low so the pagination chevrons above still show */
:where([class^="icon-"], [class*=" icon-"]):empty {
    display: none;
}
