/* DULLIE by Mike, DF3VM - see dullie/__init__.py for license terms. */
body { font-family: monospace, sans-serif; background-color: #121212; color: #e0e0e0; margin: 15px; }
h2 { color: #00ffcc; border-bottom: 1px solid #333; padding-bottom: 5px; margin-top: 0; font-size: 1.3em; }
h3 { font-size: 1.05em; margin-top: 0; margin-bottom: 8px; }
h4 { font-size: 0.9em; margin-top: 10px; margin-bottom: 5px; }
[hidden] { display: none !important; }

.top-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.top-bar h2 { flex: 1; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 15px; }
@media (max-width: 900px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { background-color: #1e1e1e; padding: 12px; border-radius: 6px; border: 1px solid #333; margin-bottom: 15px; }

.message { background: #b71c1c; color: #fff; padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }
.hint { margin: 4px 0; font-size: 0.85em; color: #aaa; overflow-wrap: anywhere; }
.footer { font-size: 0.75em; color: #777; text-align: center; }

.status-badge { padding: 2px 6px; border-radius: 3px; font-weight: bold; font-size: 0.75em; display: inline-block; }
.connected { background-color: #1b5e20; color: #81c784; }
.connecting { background-color: #f57f17; color: #fff59d; }
.disconnected { background-color: #b71c1c; color: #ef9a9a; }

table { width: 100%; border-collapse: collapse; margin: 5px 0; font-size: 0.85em; }
th, td { text-align: left; padding: 5px 4px; border-bottom: 1px solid #2a2a2a; vertical-align: middle; overflow-wrap: anywhere; }
th { color: #888; font-size: 0.8em; }

.spot-header { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 10px; }
.search-container { display: flex; justify-content: center; width: 100%; }
.search-box {
    background: #0a0a0a; border: 1px solid #00ffcc; color: #00ffcc; padding: 5px 10px;
    border-radius: 4px; font-family: monospace; font-size: 0.9em; text-transform: uppercase;
    outline: none; width: 70%; max-width: 250px; text-align: center;
}
.search-box:focus { box-shadow: 0 0 6px rgba(0, 255, 204, 0.6); }

.tx-state { font-size: 0.8em; padding: 4px 8px; border-radius: 3px; margin-bottom: 6px; overflow-wrap: anywhere; }
.tx-ready { background-color: #1b5e20; color: #c8e6c9; }
.tx-blocked { background-color: #3a2a00; color: #ffe082; }
.spot-result { font-size: 0.8em; min-height: 1.2em; margin-bottom: 6px; overflow-wrap: anywhere; }
.spot-result.ok { color: #81c784; }
.spot-result.failed { color: #ef9a9a; }

.manual-spot-form {
    display: flex; flex-wrap: wrap; gap: 6px; background: #121212; padding: 8px;
    border-radius: 5px; border: 1px solid #333; margin-bottom: 6px;
}
.manual-spot-form input, .add-cluster-form input, .add-cluster-form select, .config-field input, .config-field select, .config-field textarea, .login-form input {
    background: #0a0a0a; border: 1px solid #444; color: #00ffcc; padding: 4px 6px;
    border-radius: 3px; font-family: monospace; font-size: 0.85em;
}
.spot-freq { width: 100px; text-transform: uppercase; }
.spot-call { width: 90px; text-transform: uppercase; }
.spot-comment { flex: 1; min-width: 120px; }

.spot-list { font-size: 0.85em; color: #00ffcc; height: 480px; overflow: auto; background: #0a0a0a; padding: 8px; border-radius: 4px; }
.spot-entry { border-bottom: 1px solid #1a1a1a; padding: 2px 0; white-space: pre; }
.spot-empty { color: #888; text-align: center; padding: 10px; }
.time { color: #888; margin-right: 8px; }

.btn-group { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-btn {
    flex: 1 1 auto; min-width: 42px; padding: 4px 6px; font-size: 0.75em; font-weight: bold;
    border: none; border-radius: 3px; cursor: pointer; text-align: center;
}
.filter-btn.active { background-color: #2e7d32; color: #ffffff; }
.filter-btn.inactive { background-color: #c62828; color: #ffffff; opacity: 0.6; }
.filter-btn:hover { opacity: 0.9; }

.action-btn {
    padding: 4px 10px; font-size: 0.75em; font-weight: bold; border: none; border-radius: 3px;
    cursor: pointer; color: #fff; text-transform: uppercase;
}
.btn-connect { background-color: #2e7d32; }
.btn-connect:hover { background-color: #388e3c; }
.btn-delete { background-color: #d32f2f; }
.btn-delete:hover { background-color: #f44336; }
.btn-neutral { background-color: #424242; }
.btn-neutral:hover { background-color: #555; }

.config-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.config-field { display: flex; flex-direction: column; }
.config-field label { font-size: 0.75em; color: #aaa; margin-bottom: 2px; }
.full-width { grid-column: span 2; }
.save-btn {
    grid-column: span 2; padding: 6px; background-color: #0277bd; color: white; border: none;
    border-radius: 3px; font-size: 0.8em; font-weight: bold; cursor: pointer; margin-top: 2px;
}
.save-btn:hover { background-color: #0288d1; }
.save-status { grid-column: span 2; font-size: 0.75em; color: #81c784; text-align: center; height: 14px; }

.add-cluster-form { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.add-cluster-form input[type="text"] { flex: 2; min-width: 0; }
.add-cluster-form input[type="number"] { flex: 1; min-width: 0; }

.checkbox-cell { text-align: center; width: 35px; font-size: 0.75em; }
.checkbox-cell input { cursor: pointer; width: 14px; height: 14px; }
.section-divider { border-top: 1px solid #333; margin: 12px 0 8px 0; }
.logger-list { margin: 4px 0; padding-left: 18px; font-size: 0.8em; }
.action-btn:disabled { opacity: 0.4; cursor: default; }
/* Viewers: everything that only the admin may change is hidden or locked.
   The server enforces this on its own; see VIEWER_API in web.py. */
body.role-viewer .admin-only { display: none !important; }
body.role-viewer #clusterTable .btn-delete { display: none; }
/* Two buttons per row: in a narrow column they stack instead of squeezing
   the host name and the status into one letter per line. */
.cluster-actions .action-btn { margin: 2px 4px 2px 0; }
#clusterTable .status-badge { white-space: nowrap; }
#clusterTable td:nth-child(3) { min-width: 9ch; }
.filter-btn:disabled { cursor: default; }
.viewer-form { flex-wrap: wrap; }
.viewer-form input[type="text"], .viewer-form input[type="password"] { flex: 1 1 130px; min-width: 0; }

/* Hunting calls. */
.hunt-form { display: flex; flex-direction: column; gap: 8px; }
.hunt-form .action-btn { align-self: flex-start; }
.hunt-form .save-status { height: auto; min-height: 14px; text-align: left; overflow-wrap: anywhere; }
.config-field textarea { resize: vertical; min-height: 5em; text-transform: uppercase; }
.config-field input[type="file"] { text-transform: none; }
.spot-hunted { background: #6a4b00; color: #ffffff; font-weight: bold; }
.spot-hunted .time { color: inherit; }
.sound-hint { font-weight: bold; }

/* About popup. It is a .card as well, so every theme colours it like its panels. */
.config-field.stacked { margin-top: 8px; }
.about-open { margin-top: 10px; }
.about-dialog {
    color: inherit; box-sizing: border-box; width: min(480px, calc(100vw - 24px));
    max-height: calc(100vh - 24px); overflow: auto; margin: auto; font-size: 0.95em; line-height: 1.45;
}
.about-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.about-dialog p { margin: 8px 0; }

/* TX disabled by policy: spot form and TX column are greyed out. */
.manual-spot-form input:disabled { opacity: 0.4; cursor: not-allowed; }
.checkbox-cell input:disabled { opacity: 0.35; cursor: not-allowed; }
#clusterTable.tx-locked th:nth-child(2) { opacity: 0.4; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; align-items: start; }
.settings-section { min-width: 0; border-top: 1px solid #333; }
.settings-section .config-form { margin-top: 0; }
.access-expired { color: #888; }

.login-card { max-width: 340px; margin: 12vh auto 0; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.error-text { color: #ef9a9a; min-height: 1.2em; font-size: 0.85em; }
