/*
 * LogBeam — registo manual de QSOs (painel persistente no view.php)
 * © 2026 Octávio Filipe Pereira Gonçalves — CT7BFV
 */

/* Botão no sidebar (acima de "Importar ADIF") */
.sid-qso-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.8rem 2.4rem; border-radius: 9px; font-size: 0.95rem; font-weight: 700; cursor: pointer; border: 1px solid rgba(63,185,80,0.4); background: rgba(63,185,80,0.16); color: #3fb950; width: 100%; transition: background 0.15s, border-color 0.15s; }
.sid-qso-btn:hover, .sid-qso-btn.on { background: rgba(63,185,80,0.28); border-color: rgba(63,185,80,0.7); }
.sid-qso-btn .kbd { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 0.68rem; font-weight: 600; color: rgba(63,185,80,0.8); border: 1px solid rgba(63,185,80,0.35); border-radius: 4px; padding: 0 0.35rem; }

/* O atributo hidden tem de vencer qualquer display definido nas classes */
.qe-panel [hidden], .qe-fab[hidden], .qe-cal[hidden], .qe-modal[hidden] { display: none !important; }
.qe-login-fields { display: contents; }

/* "Autenticado como <indicativo>" no lugar dos campos de password do modal de gestão */
.qe-auth-badge { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.8rem; border-radius: 8px; border: 1px solid rgba(63,185,80,0.4); background: rgba(63,185,80,0.1); color: #3fb950; font-size: 0.92rem; margin: 0.25rem 0; }
.qe-auth-badge b { color: #e6edf3; letter-spacing: 0.04em; }
.qe-auth-out { background: transparent; border: 1px solid rgba(63,185,80,0.35); color: #8b949e; border-radius: 6px; font-size: 0.78rem; padding: 0.1rem 0.5rem; cursor: pointer; margin-left: 0.25rem; }
.qe-auth-out:hover { color: #e6edf3; border-color: #484f58; }

/* Painel ancorado ao fundo do globo */
.qe-panel { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(13,17,23,0.97); border-top: 1px solid rgba(63,185,80,0.35); box-shadow: 0 -12px 40px rgba(0,0,0,0.5); padding: 0.75rem 1.25rem 0.9rem; display: none; z-index: 300; max-height: 80%; overflow-y: auto; color: #e6edf3; font-size: 0.95rem; }   /* acima da legenda (100) e da faixa de bandas (200) do globe.js */
.qe-panel.open { display: block; }
.qe-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.qe-head h6 { margin: 0; font-size: 1rem; font-weight: 700; color: #3fb950; letter-spacing: 0.04em; text-transform: uppercase; }
.qe-status { font-size: 0.92rem; color: #8b949e; }
.qe-dest { display: flex; align-items: center; gap: 0.45rem; }
.qe-dest label { font-size: 0.78rem; color: #8b949e; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; margin: 0; }
.qe-dest select { width: auto; max-width: 280px; font-size: 0.92rem; font-weight: 600; color: #e3b341; }
.qe-iconbtn { background: transparent; border: 1px solid #30363d; color: #8b949e; border-radius: 6px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
.qe-iconbtn:hover { color: #e6edf3; border-color: #484f58; }
.qe-textbtn { background: transparent; border: 1px solid transparent; color: #8b949e; font-size: 0.85rem; cursor: pointer; padding: 0.2rem 0.5rem; border-radius: 6px; }
.qe-textbtn:hover { color: #e6edf3; border-color: #30363d; }
.qe-export { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; background: transparent; border: 1px solid #30363d; color: #e6edf3; border-radius: 6px; padding: 0.4rem 0.75rem; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.qe-export:hover:not(:disabled) { border-color: #58a6ff; color: #58a6ff; }
.qe-export:disabled { opacity: 0.45; cursor: not-allowed; }

/* Formulário */
.qe-form { display: flex; flex-wrap: wrap; gap: 0.5rem 0.6rem; align-items: flex-end; }
.qe-field { display: flex; flex-direction: column; gap: 0.2rem; }
.qe-field label { font-size: 0.8rem; color: #8b949e; text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.qe-panel .form-control, .qe-panel .form-select { background-color: #0d1117; border-color: #30363d; color: #e6edf3; }
.qe-panel .form-control:focus, .qe-panel .form-select:focus { border-color: #3fb950; box-shadow: 0 0 0 0.2rem rgba(63,185,80,0.18); background-color: #0d1117; color: #e6edf3; }
.qe-panel .form-select { padding-right: 2rem; cursor: pointer; }
.qe-call { width: 190px; font-size: 1.35rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; height: 46px; }
.qe-w-band { width: 92px; } .qe-w-mode { width: 96px; } .qe-w-freq { width: 104px; } .qe-w-rst { width: 66px; }
.qe-form .input-group > .qe-w-date { flex: 0 0 132px; width: 132px; } .qe-form .input-group > .qe-w-time { flex: 0 0 86px; width: 86px; }
.qe-save { height: 46px; padding: 0 1.1rem; font-weight: 700; white-space: nowrap; }
.qe-save .kbd { font-size: 0.65rem; font-weight: 600; opacity: 0.75; border: 1px solid rgba(255,255,255,0.35); border-radius: 4px; padding: 0 0.3rem; margin-left: 0.35rem; }
.qe-msg { min-height: 1.25rem; font-size: 0.98rem; margin-top: 0.45rem; }
.qe-msg.ok { color: #3fb950; } .qe-msg.dup { color: #e3b341; } .qe-msg.err { color: #f85149; }
.qe-sess { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.4rem; }
.qe-sess span { font-size: 0.85rem; padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid #30363d; background: #161b22; color: #8b949e; }
.qe-sess span b { color: #e6edf3; letter-spacing: 0.04em; }
.qe-hint { font-size: 0.85rem; color: #8b949e; }

/* Login (uma vez por separador) */
.qe-login { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
.qe-login p { margin: 0 0 0.3rem; font-size: 1rem; color: #8b949e; flex-basis: 100%; }
.qe-login .qe-call { width: 170px; }
.qe-login-block { flex-basis: 100%; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; font-size: 0.95rem; color: #e3b341; }

/* Criar logbook sem sair do painel */
.qe-create { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; padding: 0.7rem 0.9rem; margin-bottom: 0.7rem; border: 1px dashed rgba(63,185,80,0.5); border-radius: 8px; background: rgba(63,185,80,0.06); }

/* Cartões de resolução do indicativo e "já trabalhado" */
.qe-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.5rem; margin-top: 0.65rem; }
.qe-cards[hidden] { display: none; }
#qe-worked { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.qe-card { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0.85rem; border-radius: 8px; border: 1px solid rgba(88,166,255,0.28); background: rgba(88,166,255,0.07); }
.qe-card .lbl { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #58a6ff; }
.qe-card .val { font-size: 1.3rem; font-weight: 700; color: #ffffff; line-height: 1.25; }
.qe-card.country .val { color: #e3b341; font-size: 1.4rem; }
.qe-card .sub { font-size: 0.95rem; color: #b1bac4; }
.qe-card.warn { border-color: rgba(227,179,65,0.5); background: rgba(227,179,65,0.1); }
.qe-card.warn .lbl { color: #e3b341; }
.qe-card.wait { border-color: #30363d; background: #161b22; }
.qe-card.wait .lbl { color: #8b949e; }
.qe-card.new { border-color: rgba(63,185,80,0.5); background: rgba(63,185,80,0.1); }
.qe-card.new .lbl, .qe-card.new .val { color: #3fb950; }
.qe-card.split { flex-direction: row; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.qe-card.split .card-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1 1 260px; }
.qe-badges { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.25rem; }
.qe-badge { font-size: 0.78rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid rgba(63,185,80,0.45); color: #3fb950; }
.qe-badge.off { border-color: #30363d; color: #8b949e; }
.qe-badge.band { border-color: rgba(88,166,255,0.4); color: #58a6ff; }
.qe-card-btn { margin: 0; font-size: 1.02rem; padding: 0.75rem 1.3rem; white-space: nowrap; border: 1px solid rgba(88,166,255,0.5); color: #58a6ff; background: rgba(88,166,255,0.1); border-radius: 8px; font-weight: 600; cursor: pointer; }
.qe-card-btn:hover { background: rgba(88,166,255,0.2); color: #fff; }

/* Calendário próprio (posição fixa: nunca é recortado pelo painel) */
.qe-cal { position: fixed; z-index: 1060; width: 300px; background: #161b22; border: 1px solid #30363d; border-radius: 10px; padding: 0.6rem; box-shadow: 0 12px 32px rgba(0,0,0,0.55); }
.qe-cal[hidden] { display: none; }
.qe-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; font-size: 0.98rem; font-weight: 700; color: #e6edf3; text-transform: capitalize; }
.qe-cal-head button, .qe-cal-foot button { background: transparent; border: 1px solid #30363d; color: #8b949e; border-radius: 6px; padding: 0.15rem 0.5rem; cursor: pointer; font-size: 0.8rem; }
.qe-cal-head button:hover, .qe-cal-foot button:hover { color: #e6edf3; border-color: #484f58; }
.qe-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.qe-cal-grid .dow { font-size: 0.75rem; color: #484f58; text-align: center; text-transform: uppercase; padding: 0.15rem 0; }
.qe-cal-grid button { background: transparent; border: 1px solid transparent; color: #e6edf3; border-radius: 6px; font-size: 0.92rem; padding: 0.38rem 0; cursor: pointer; }
.qe-cal-grid button:hover { background: #21262d; }
.qe-cal-grid button.today { border-color: rgba(88,166,255,0.5); color: #58a6ff; }
.qe-cal-grid button.sel { background: rgba(63,185,80,0.25); border-color: rgba(63,185,80,0.6); color: #3fb950; font-weight: 700; }
.qe-cal-grid button.future { color: #484f58; opacity: 0.45; cursor: not-allowed; }
.qe-cal-foot { display: flex; justify-content: flex-end; margin-top: 0.4rem; }

/* Popup com as linhas dos QSOs */
.qe-modal { position: fixed; inset: 0; z-index: 1070; background: rgba(1,4,9,0.78); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.qe-modal[hidden] { display: none; }
.qe-box { background: #0d1117; border: 1px solid #30363d; border-radius: 12px; width: min(980px, 100%); max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,0.65); color: #e6edf3; }
.qe-box-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid #30363d; font-size: 1rem; font-weight: 700; }
.qe-box-head .sub { font-size: 0.85rem; color: #8b949e; font-weight: 400; }
.qe-box-body { overflow: auto; }
.qe-rows { overflow-x: auto; }
.qe-rows table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.qe-rows th { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: #8b949e; font-weight: 700; padding: 0.4rem 0.85rem; text-align: left; border-bottom: 1px solid #30363d; white-space: nowrap; }
.qe-rows td { padding: 0.4rem 0.85rem; border-bottom: 1px solid rgba(48,54,61,0.6); color: #e6edf3; white-space: nowrap; }
.qe-rows tr:last-child td { border-bottom: none; }
.qe-rows td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.qe-rows td.lb { color: #e3b341; font-weight: 700; letter-spacing: 0.04em; }

/* Botão "Registar QSO" no canto inferior direito do globo (acima da legenda, abaixo do painel) */
.qe-fab { position: absolute; right: 16px; bottom: 16px; z-index: 250; display: none; align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem; border-radius: 999px; border: 1px solid rgba(63,185,80,0.55); background: rgba(35,134,54,0.92); color: #fff; font-size: 1rem; font-weight: 700; letter-spacing: 0.01em; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,0.55), 0 0 0 4px rgba(63,185,80,0.12); backdrop-filter: blur(6px); transition: background 0.15s, transform 0.15s, box-shadow 0.15s; }
.qe-fab:hover { background: #2ea043; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,0,0,0.6), 0 0 0 6px rgba(63,185,80,0.16); }
.qe-fab i { font-size: 1.15rem; }
.qe-fab .kbd { font-size: 0.68rem; font-weight: 600; opacity: 0.85; border: 1px solid rgba(255,255,255,0.45); border-radius: 4px; padding: 0 0.35rem; }
.qe-fab.on { display: none; }   /* o painel aberto cobre o canto */
@media (max-width: 767px) {
    .qe-fab { display: inline-flex; right: 12px; bottom: 12px; padding: 0.65rem 1rem; font-size: 0.95rem; }   /* só em telemóvel, onde o sidebar está escondido */
    .qe-fab.on { display: none; }
    .qe-fab .kbd { display: none; }
    .qe-panel { position: fixed; bottom: 0; left: 0; right: 0; border-radius: 14px 14px 0 0; padding-bottom: max(0.9rem, env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto; z-index: 1050; }
    .qe-form { display: grid; grid-template-columns: 1fr 1fr; }
    .qe-field.full { grid-column: 1 / -1; }
    .qe-call, .qe-w-band, .qe-w-mode, .qe-w-freq, .qe-w-rst { width: 100%; }
    .qe-form .input-group { width: 100% !important; } .qe-form .input-group > .qe-w-date, .qe-form .input-group > .qe-w-time { flex: 1 1 auto; width: 1%; }
    .qe-save { grid-column: 1 / -1; width: 100%; }
    .qe-save .kbd { display: none; }
}
