/* Sistema visual común para las páginas internas de Hub Providencia.
   Usa los tokens y botones definidos en hub-reimagined.css (landing). */

:root {
    --app-panel: rgba(10, 10, 18, 0.9);
    --app-panel-2: rgba(18, 18, 30, 0.9);
    --app-line: rgba(237, 183, 0, 0.25);
    --app-line-soft: rgba(255, 255, 255, 0.1);
    --app-text-soft: #b9b9c2;
    --app-ok: #00D9FF;
    --app-error: #ff7a7a;
    --app-field: #08080f;
}

/* Estructura */
.app-main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 140px 3rem 90px;
}

.app-main--narrow { max-width: 620px; }
.app-main--center { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }

.app-head { margin-bottom: 2.5rem; }

.app-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--hub-yellow);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 1rem;
}

.app-eyebrow::before {
    content: '';
    width: 40px;
    height: 1px;
    background: var(--hub-yellow);
}

.app-title {
    font-family: 'BTOFont', sans-serif;
    font-size: clamp(2.2rem, 4.5vw, 3.6rem);
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.app-lead {
    color: var(--app-text-soft);
    font-size: 1.05rem;
    max-width: 640px;
    margin-top: 0.875rem;
}

/* Paneles */
.app-panel {
    position: relative;
    background: linear-gradient(145deg, var(--app-panel-2) 0%, var(--app-panel) 100%);
    border: 1px solid var(--app-line);
    padding: 2.25rem;
}

.app-panel::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 48px;
    height: 48px;
    border-top: 2px solid var(--hub-yellow);
    border-left: 2px solid var(--hub-yellow);
}

.app-panel--wide { max-width: 100%; }

/* Formularios */
.app-form { display: grid; gap: 1.25rem; }

.app-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.app-field { display: grid; gap: 0.45rem; min-width: 0; }

.app-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--hub-white);
}

.app-input,
.app-field input,
.app-field select,
.app-field textarea {
    width: 100%;
    min-height: 50px;
    padding: 0.75rem 0.95rem;
    font: inherit;
    font-size: 1rem;
    color: var(--hub-white);
    background: var(--app-field);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.app-field textarea { min-height: 110px; resize: vertical; }

.app-field select option { background: #0b0b12; color: var(--hub-white); }

.app-field input::placeholder,
.app-field textarea::placeholder { color: #6f6f7a; }

.app-field input:hover,
.app-field select:hover,
.app-field textarea:hover { border-color: rgba(237, 183, 0, 0.5); }

.app-field input:focus-visible,
.app-field select:focus-visible,
.app-field textarea:focus-visible {
    outline: none;
    border-color: var(--hub-yellow);
    box-shadow: 0 0 0 3px rgba(237, 183, 0, 0.25);
}

.app-field input:disabled,
.app-field select:disabled,
.app-field textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.app-hint { font-size: 0.85rem; color: #8a8a95; }

/* Botones de ancho completo y estados */
.app-actions { display: flex; flex-wrap: wrap; gap: 0.875rem; align-items: center; }
.app-actions .hub-btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.app-actions--stack { flex-direction: column; align-items: stretch; }

.hub-btn:disabled,
.hub-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.hub-btn { font-family: inherit; cursor: pointer; }

/* Alertas (las usan los scripts con las clases alert / alert-error / alert-success) */
.alert {
    padding: 1rem 1.15rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--hub-yellow);
    background: rgba(237, 183, 0, 0.08);
    color: var(--hub-white);
    font-size: 0.98rem;
}

.alert-error {
    border-left-color: var(--app-error);
    background: rgba(255, 122, 122, 0.08);
    color: #ffd6d6;
}

.alert-success {
    border-left-color: var(--app-ok);
    background: rgba(0, 217, 255, 0.07);
    color: #d6f7ff;
}

.app-note { color: var(--app-text-soft); font-size: 0.95rem; }

.app-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

.app-links a { color: var(--hub-yellow); text-decoration: none; }
.app-links a:hover { text-decoration: underline; }

/* Estados de carga y vacíos */
.app-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    color: var(--app-text-soft);
}

.app-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--app-text-soft);
    padding: 1.5rem 0;
}

.app-loading::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(237, 183, 0, 0.25);
    border-top-color: var(--hub-yellow);
    border-radius: 50%;
    animation: appSpin 0.9s linear infinite;
}

@keyframes appSpin { to { transform: rotate(360deg); } }

/* Tarjetas de reserva */
.app-grid { display: grid; gap: 1.5rem; }

.app-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
    background: linear-gradient(145deg, var(--app-panel-2) 0%, var(--app-panel) 100%);
    border: 1px solid var(--app-line-soft);
    border-left: 3px solid var(--hub-yellow);
    padding: 1.75rem;
}

.app-card-title {
    font-family: 'BTOFont', sans-serif;
    font-size: 1.5rem;
    text-transform: uppercase;
    margin-bottom: 0.875rem;
}

.app-dl { display: grid; gap: 0.45rem; color: #dcdce2; font-size: 0.98rem; }
.app-dl strong { color: var(--hub-white); font-weight: 700; margin-right: 0.35rem; }

.app-status {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid currentColor;
    color: var(--app-ok);
}

.app-status--warn { color: var(--hub-yellow); }
.app-status--muted { color: #9a9aa6; }

/* QR: fondo blanco para garantizar contraste de lectura */
.app-qr {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    text-align: center;
}

.app-qr img {
    width: 200px;
    height: 200px;
    max-width: 100%;
    background: #ffffff;
    padding: 12px;
}

.app-qr code {
    font-size: 0.78rem;
    color: var(--app-text-soft);
    word-break: break-all;
}

/* Credencial del perfil */
.app-credential {
    position: relative;
    display: grid;
    gap: 1.5rem;
    padding: 2rem;
    border: 1px solid var(--app-line);
    background:
        radial-gradient(circle at 90% 0%, rgba(0, 82, 255, 0.22), transparent 55%),
        linear-gradient(145deg, #0d0d18 0%, #050509 100%);
    overflow: hidden;
}

.app-credential::after {
    content: 'HUB PROVIDENCIA';
    position: absolute;
    right: 1.25rem;
    bottom: 1rem;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    color: rgba(237, 183, 0, 0.5);
}

.app-credential-name {
    font-family: 'BTOFont', sans-serif;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    text-transform: uppercase;
    line-height: 1.05;
}

.app-kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem 1.5rem;
}

.app-kv dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: #8a8a95; }
.app-kv dd { font-size: 1rem; color: var(--hub-white); overflow-wrap: anywhere; }

/* Tablas (administración) */
.app-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--app-line-soft);
    background: var(--app-panel);
}

.app-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.app-table th,
.app-table td {
    text-align: left;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--app-line-soft);
    vertical-align: top;
}

.app-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--hub-yellow);
    background: rgba(237, 183, 0, 0.06);
    position: sticky;
    top: 0;
}

.app-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.app-table small { color: #8a8a95; }

/* Métricas */
.app-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1.25rem;
}

.app-metric {
    background: linear-gradient(145deg, var(--app-panel-2) 0%, var(--app-panel) 100%);
    border: 1px solid var(--app-line-soft);
    padding: 1.5rem;
}

.app-metric-value {
    font-family: 'BTOFont', sans-serif;
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--hub-yellow);
    line-height: 1;
}

.app-metric-label { margin-top: 0.6rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--app-text-soft); }

/* Escáner QR */
.app-scanner {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    background: #000;
    border: 1px solid var(--app-line);
    overflow: hidden;
}

.app-scanner::before,
.app-scanner::after {
    content: '';
    position: absolute;
    width: 36px;
    height: 36px;
    border: 2px solid var(--hub-yellow);
    z-index: 2;
    pointer-events: none;
}

.app-scanner::before { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.app-scanner::after { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.app-scanner video { width: 100%; height: auto; display: block; }

.app-scan-result {
    display: grid;
    gap: 0.9rem;
    margin: 1.25rem 0;
    padding: 1.25rem;
    border: 1px solid var(--app-line-soft);
    background: rgba(255, 255, 255, 0.02);
}

.app-timer {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid var(--hub-yellow);
    color: var(--hub-yellow);
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 1.25rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-main { padding: 130px 2rem 80px; }
}

@media (max-width: 768px) {
    .app-main { padding: 120px 1.25rem 70px; }
    .app-row { grid-template-columns: 1fr; }
    .app-card { grid-template-columns: 1fr; }
    .app-panel { padding: 1.5rem; }
    .app-kv { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .app-main { padding: 110px 1rem 60px; }
    .app-panel, .app-card, .app-credential { padding: 1.25rem; }
    .app-qr img { width: 170px; height: 170px; }
}

@media (prefers-reduced-motion: reduce) {
    .app-loading::before { animation: none; }
}

/* Enlaces del menú (escritorio y cajón móvil) */
.hub-drawer .hub-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hub-drawer .hub-link::after { display: none; }

.hub-drawer-actions .hub-btn { min-height: 48px; }

.hub-link[aria-current="page"] { color: var(--hub-yellow); }

.hub-footer-logo { max-width: 100%; }

/* Clases de página: reservas, administración y escáner */
.app-main--wide { max-width: 1400px; }

.app-head--row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
}

.app-reserve-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.app-rules {
    border-top: 2px solid var(--hub-yellow);
    padding: 1.5rem 0 0;
    color: var(--app-text-soft);
    font-size: 0.97rem;
}

.app-rules-title {
    font-family: 'BTOFont', sans-serif;
    font-size: 1.25rem;
    text-transform: uppercase;
    color: var(--hub-white);
    margin-bottom: 1rem;
}

.app-rules ul { display: grid; gap: 0.85rem; padding-left: 1.1rem; }
.app-rules li::marker { color: var(--hub-yellow); }

.app-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.app-tile {
    display: grid;
    gap: 0.6rem;
    padding: 2rem;
    text-decoration: none;
    color: var(--hub-white);
    background: linear-gradient(145deg, var(--app-panel-2) 0%, var(--app-panel) 100%);
    border: 1px solid var(--app-line-soft);
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.app-tile:hover { border-color: var(--hub-yellow); transform: translateY(-3px); }
.app-tile:focus-visible { outline: 2px solid var(--hub-yellow); outline-offset: 4px; }

.app-tile-kicker {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--hub-yellow);
}

.app-tile-title {
    font-family: 'BTOFont', sans-serif;
    font-size: 1.7rem;
    text-transform: uppercase;
}

.app-tile p { color: var(--app-text-soft); }

.app-section-title {
    font-family: 'BTOFont', sans-serif;
    font-size: 1.4rem;
    text-transform: uppercase;
    margin: 3rem 0 1.25rem;
}

.app-scan-ok { font-size: 1.1rem; font-weight: 700; }

.app-scan-result p,
.app-scan-result div { color: #dcdce2; }

/* Escáner: que la librería de cámara respete el tema */
#qr-reader { width: 100%; }
#qr-reader video { width: 100% !important; height: auto !important; }
#qr-reader__dashboard_section_csr button,
#qr-reader button {
    font-family: inherit;
    min-height: 44px;
    padding: 0.5rem 1rem;
    margin: 0.4rem 0.25rem;
    background: transparent;
    color: var(--hub-white);
    border: 1px solid var(--hub-yellow);
    cursor: pointer;
}
#qr-reader select {
    min-height: 44px;
    background: var(--app-field);
    color: var(--hub-white);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.4rem;
}

@media (max-width: 900px) {
    .app-reserve-grid { grid-template-columns: 1fr; }
    .app-grid--2 { grid-template-columns: 1fr; }
}

.app-actions--spaced { margin-top: 2rem; }
.app-actions--tight { margin-top: 1rem; }
.app-hint--center { text-align: center; margin-top: 1rem; }
