/*
 * ON3HTB AirStatus
 * Classes préfixées en ht- pour éviter les collisions avec le CSS HamTools existant.
 */

.ht-airstatus-page,
.ht-admin-page {
    min-height: 100vh;
    box-sizing: border-box;
    padding: 2rem;
    display: grid;
    place-items: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f8fafc;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 32rem),
        linear-gradient(135deg, #0f172a, #111827);
}



.ht-callsigns-body {
    min-height: 0;
    margin: 0;
    background: #111827;
}

.ht-admin-page.ht-callsigns-page {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding-block: 2rem;
}

.ht-admin-page.ht-callsigns-page > .ht-callsigns-card {
    margin: 0 auto;
    overflow: hidden;
}

.ht-callsigns-footer {
    width: min(100%, 840px);
    margin: 0.75rem auto 0;
    color: #64748b;
    font-size: 0.78rem;
    text-align: center;
}

.ht-status-card,
.ht-admin-card {
    width: min(100%, 760px);
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1.5rem;
    background: rgba(15, 23, 42, 0.82);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(18px);
}

.ht-status-card {
    padding: 2rem;
    overflow: hidden;
    position: relative;
}

.ht-status-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-top: 4px solid rgba(148, 163, 184, 0.4);
    pointer-events: none;
}

.ht-status-card--on::before {
    border-top-color: #22c55e;
}

.ht-status-card--off::before {
    border-top-color: #64748b;
}

.ht-status-header {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.ht-status-kicker {
    margin: 0;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.8rem;
    font-weight: 700;
}

.ht-status-callsign {
    margin: 0;
    font-size: clamp(3rem, 12vw, 7rem);
    line-height: 0.9;
    letter-spacing: -0.08em;
}

.ht-status-badge {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ht-status-badge--on {
    color: #dcfce7;
    background: rgba(34, 197, 94, 0.16);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.ht-status-badge--off {
    color: #e2e8f0;
    background: rgba(100, 116, 139, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.ht-status-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 1.4rem currentColor;
}

.ht-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
}

.ht-status-grid > div {
    padding: 1rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.ht-status-grid dt {
    color: #94a3b8;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.ht-status-grid dd {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.ht-status-comment,
.ht-status-off-message,
.ht-status-expired {
    margin: 1.4rem 0 0;
    color: #cbd5e1;
    font-size: 1.05rem;
    line-height: 1.6;
}

.ht-status-expired {
    color: #fde68a;
}

.ht-status-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    color: #94a3b8;
    font-size: 0.92rem;
}

.ht-admin-card {
    padding: 2rem;
}

.ht-admin-card--wide {
    width: min(100%, 920px);
}

.ht-callsigns-card {
    width: min(100%, 1180px);
}

.ht-admin-eyebrow {
    margin: 0 0 0.35rem;
    color: #55d6be;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.ht-callsigns-card .ht-admin-muted {
    max-width: 48rem;
    margin-bottom: 0;
}

.ht-callsigns-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

.ht-callsigns-editor,
.ht-cluster-settings {
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.1rem;
    background: rgba(15, 23, 42, 0.34);
}

.ht-callsigns-editor {
    display: grid;
    gap: 1rem;
}

.ht-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ht-section-heading h2 {
    margin: 0 0 0.3rem;
    color: #f8fafc;
    font-size: 1.15rem;
}

.ht-section-heading > div > .ht-callsigns-hint {
    display: block;
    max-width: 52rem;
}

.ht-section-heading .ht-callsigns-count {
    flex: 0 0 auto;
    min-width: 5.5rem;
    justify-items: center;
    padding: 0.6rem 0.8rem;
}

.ht-section-heading .ht-callsigns-count strong {
    font-size: 1.5rem;
}

.ht-callsigns-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.75rem;
}

.ht-callsigns-search {
    display: grid;
    grid-template-columns: minmax(0, 22rem);
    width: min(100%, 22rem);
    gap: 0.35rem;
    margin: 0;
}

.ht-callsigns-search label,
.ht-callsigns-search input {
    grid-column: 1;
}

.ht-callsigns-search > .ht-callsigns-hint {
    grid-column: 2;
    grid-row: 2;
}

.ht-callsigns-search input {
    min-width: 0;
}

.ht-callsigns-table-wrap {
    max-height: min(52vh, 34rem);
}

.ht-cluster-settings {
    display: grid;
    gap: 1.25rem;
}

.ht-settings-subsection {
    display: grid;
    gap: 0.8rem;
}

.ht-settings-subheading h3 {
    margin: 0 0 0.25rem;
    color: #e2e8f0;
    font-size: 0.98rem;
}

.ht-settings-subheading p {
    margin: 0;
}

.ht-settings-grid {
    display: grid;
    grid-template-columns: minmax(15rem, 0.8fr) minmax(0, 1.2fr);
    align-items: start;
    gap: 1rem;
}

.ht-settings-grid--sources,
.ht-settings-grid--filters,
.ht-settings-grid--preferences {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ht-settings-grid--sources > .ht-dxcc-filter,
.ht-settings-grid--filters > .ht-spot-filter-group--activities {
    grid-column: 1 / -1;
}

.ht-settings-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.34);
}

.ht-settings-card.ht-field {
    display: grid;
    align-content: start;
    gap: 0.45rem;
}

.ht-settings-card.ht-field input {
    margin: 0;
}

.ht-full-cluster-setting {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(85, 214, 190, 0.24);
    border-radius: 0.85rem;
    color: #e2e8f0;
    background: rgba(85, 214, 190, 0.06);
    cursor: pointer;
}

.ht-full-cluster-setting input {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin: 0.2rem 0 0;
    accent-color: #55d6be;
}

.ht-full-cluster-setting > span,
.ht-full-cluster-setting .ht-callsigns-hint {
    display: grid;
    gap: 0.25rem;
}

.ht-spot-filter-group {
    min-width: 0;
}

.ht-settings-note {
    margin: 0;
}

.ht-admin-card h1 {
    margin: 0 0 0.25rem;
    font-size: 2rem;
}

.ht-admin-muted {
    margin: 0 0 1.5rem;
    color: #94a3b8;
}

.ht-admin-topbar {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.ht-admin-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.ht-admin-nav a {
    color: #bae6fd;
    text-decoration: none;
    font-weight: 700;
}

.ht-admin-nav a:hover {
    text-decoration: underline;
}

.ht-form {
    display: grid;
    gap: 1rem;
}

.ht-form label,
.ht-fieldset legend {
    color: #e2e8f0;
    font-weight: 700;
}

.ht-form input[type="text"],
.ht-form input[type="password"],
.ht-form textarea,
.ht-form select {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.4rem;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    font: inherit;
}

.ht-form textarea {
    min-height: 20rem;
    resize: vertical;
    line-height: 1.55;
}

.ht-form textarea.ht-contest-keywords {
    min-height: 6rem;
}

.ht-callsigns-table-wrap {
    max-height: clamp(12rem, 42vh, 20rem);
    overflow: auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.42);
}

.ht-callsigns-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ht-callsigns-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.55rem 0.65rem;
    color: #94a3b8;
    background: #111f30;
    font-size: 0.75rem;
    text-align: left;
}

.ht-callsigns-table th:first-child {
    width: 30%;
}

.ht-callsigns-table th:nth-child(3) {
    width: 4.5rem;
}

.ht-callsigns-table th:nth-child(4) {
    width: 4.5rem;
}

.ht-callsigns-table th:last-child {
    width: 3rem;
}

.ht-callsigns-table th:nth-child(3),
.ht-callsigns-table th:nth-child(4),
.ht-callsign-alert-cell,
.ht-callsign-contest-cell {
    text-align: center;
}

.ht-form .ht-callsigns-table input.ht-callsign-alert {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: #fbbf24;
    vertical-align: middle;
}

.ht-form .ht-callsigns-table input.ht-callsign-contest {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: #fb7185;
    vertical-align: middle;
}

.ht-callsigns-table td {
    padding: 0.15rem 0.35rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.ht-form .ht-callsigns-table input {
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.55rem;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.88);
    font: inherit;
    font-size: 0.86rem;
}

.ht-callsigns-table input:focus {
    outline: 2px solid rgba(56, 189, 248, 0.72);
    outline-offset: 1px;
}

.ht-callsign-remove {
    display: grid;
    width: 1.7rem;
    height: 1.7rem;
    place-items: center;
    border: 1px solid rgba(248, 113, 113, 0.22);
    border-radius: 0.55rem;
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.14);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

.ht-callsign-remove:hover {
    background: rgba(127, 29, 29, 0.3);
}

.ht-callsigns-hint {
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.5;
}

.ht-callsigns-search,
.ht-callsigns-search label,
.ht-dxcc-filter {
    display: grid;
    gap: 0.55rem;
}

.ht-callsigns-search input[type="search"] {
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.85rem;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.88);
    font: inherit;
    appearance: none;
}

.ht-dxcc-filter > label {
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 700;
}

.ht-dxcc-entry {
    display: flex;
    gap: 0.5rem;
}

.ht-dxcc-entry input {
    flex: 1;
    min-width: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.75rem;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.88);
    font: inherit;
}

.ht-dxcc-entry input:focus {
    outline: 2px solid rgba(56, 189, 248, 0.72);
    outline-offset: 1px;
}

.ht-dxcc-entry .ht-button {
    flex: 0 0 auto;
}

.ht-dxcc-selected {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ht-dxcc-selected[hidden] {
    display: none;
}

.ht-dxcc-selected li {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.55rem 0.4rem 0.75rem;
    border: 1px solid rgba(85, 214, 190, 0.2);
    border-radius: 0.65rem;
    color: #cbd8e6;
    background: rgba(85, 214, 190, 0.06);
    font-size: 0.82rem;
}

.ht-dxcc-selected li span {
    overflow-wrap: anywhere;
}

.ht-dxcc-remove {
    display: grid;
    flex: 0 0 auto;
    width: 1.65rem;
    height: 1.65rem;
    place-items: center;
    border: 1px solid rgba(248, 113, 113, 0.22);
    border-radius: 0.5rem;
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.14);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
}

.ht-dxcc-remove:hover {
    background: rgba(127, 29, 29, 0.3);
}

.ht-spot-filter-group {
    min-width: 0;
    margin: 0;
    padding: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.32);
}

.ht-spot-filter-group legend {
    padding: 0 0.35rem;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 700;
}

.ht-spot-filter-group > .ht-callsigns-hint {
    display: block;
    margin-bottom: 0.65rem;
}

.ht-spot-filter-options {
    display: grid;
    max-height: 12rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem 0.6rem;
    overflow-y: auto;
}

.ht-spot-filter-options label {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.4rem;
    color: #cbd8e6;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
}

.ht-spot-filter-options input {
    flex: 0 0 auto;
    width: 0.95rem;
    height: 0.95rem;
    margin: 0;
    accent-color: #55d6be;
}

.ht-spot-filter-options--modes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ht-callsigns-search input:focus {
    outline: 2px solid rgba(56, 189, 248, 0.72);
    outline-offset: 1px;
}

.ht-callsigns-search input::placeholder {
    color: #74869c;
}

.ht-callsigns-count {
    display: grid;
    gap: 0.2rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 1rem;
    background: rgba(14, 116, 144, 0.12);
}

.ht-callsigns-count strong {
    color: #bae6fd;
    font-size: 2rem;
    line-height: 1;
}

.ht-callsigns-count span {
    color: #94a3b8;
    font-size: 0.82rem;
}

.ht-callsigns-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.ht-worked-reset {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(248, 113, 113, 0.22);
    border-radius: 1rem;
    background: rgba(127, 29, 29, 0.08);
}

.ht-worked-reset p {
    margin: 0.25rem 0 0;
}

.ht-worked-reset .ht-button {
    flex: 0 0 auto;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ht-form input:focus,
.ht-form textarea:focus,
.ht-form select:focus {
    outline: 2px solid rgba(56, 189, 248, 0.72);
    outline-offset: 2px;
}

.ht-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ht-fieldset {
    margin: 0;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
}

.ht-radio-line {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    margin-top: 0.75rem;
}

.ht-radio-line input {
    transform: scale(1.15);
}

.ht-admin-status-preview {
    padding: 1rem;
    color: #cbd5e1;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    line-height: 1.6;
}

.ht-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.ht-button {
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1.2rem;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.ht-button--primary {
    color: #052e16;
    background: #86efac;
}

.ht-button--primary:hover {
    background: #bbf7d0;
}

.ht-button--secondary {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.ht-button--secondary:hover {
    background: rgba(148, 163, 184, 0.28);
}

.ht-alert {
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    line-height: 1.5;
}

.ht-alert--dismissing {
    opacity: 0;
    transform: translateY(-0.25rem);
    pointer-events: none;
    transition: opacity 300ms ease, transform 300ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .ht-alert--dismissing {
        transition-duration: 0.01ms;
    }
}

.ht-alert--success {
    color: #dcfce7;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.38);
}

.ht-alert--error {
    color: #fee2e2;
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.38);
}

.ht-alert--warning {
    color: #fef3c7;
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.38);
}

@media (max-width: 760px) {
    .ht-airstatus-page,
    .ht-admin-page {
        padding: 1rem;
    }

    .ht-admin-page.ht-callsigns-page {
        padding-block: 1rem;
    }

    .ht-status-card,
    .ht-admin-card {
        padding: 1.25rem;
        border-radius: 1.2rem;
    }

    .ht-status-grid,
    .ht-form-grid {
        grid-template-columns: 1fr;
    }

    .ht-settings-grid {
        grid-template-columns: 1fr;
    }

    .ht-settings-grid--sources > .ht-dxcc-filter,
    .ht-settings-grid--filters > .ht-spot-filter-group--activities {
        grid-column: auto;
    }

    .ht-callsigns-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .ht-worked-reset {
        align-items: stretch;
        flex-direction: column;
    }

    .ht-callsigns-editor,
    .ht-cluster-settings {
        padding: 1rem;
    }

    .ht-section-heading {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .ht-callsigns-table th:first-child {
        width: 38%;
    }

    .ht-admin-topbar {
        display: grid;
    }
}

@media (max-width: 560px) {
    .ht-callsigns-table-wrap {
        max-height: min(58vh, 32rem);
        overflow-x: hidden;
    }

    .ht-callsigns-table,
    .ht-callsigns-table tbody {
        display: block;
        width: 100%;
    }

    .ht-callsigns-table thead {
        display: none;
    }

    .ht-callsigns-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        align-items: center;
        gap: 0.35rem 0.5rem;
        padding: 0.55rem;
        border-top: 1px solid rgba(148, 163, 184, 0.14);
    }

    .ht-callsigns-table td {
        min-width: 0;
        padding: 0;
        border: 0;
    }

    .ht-callsigns-table td:first-child {
        grid-column: 1;
        grid-row: 1;
    }

    .ht-callsigns-table td:nth-child(2) {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .ht-callsigns-table td:nth-child(2)::before {
        display: block;
        margin-bottom: 0.2rem;
        color: #94a3b8;
        content: "Commentaire";
        font-size: 0.72rem;
        font-weight: 650;
    }

    .ht-callsigns-table td:nth-child(3) {
        grid-column: 2;
        grid-row: 1;
    }

    .ht-callsigns-table td:nth-child(4) {
        grid-column: 3;
        grid-row: 1;
    }

    .ht-callsigns-table td:last-child {
        grid-column: 4;
        grid-row: 1;
    }
}
