/* app.css - Hoja de estilos estática de card.infobox.pe.
   Reemplaza el script CDN de Tailwind (no apto para producción: recompila en el
   navegador en cada carga). Sin build step: se sirve tal cual desde el hosting. */

:root {
    --brand-purple: #3D1B7B;
    --brand-purple-dark: #261054;
    --brand-purple-soft: rgba(63, 27, 123, 0.08);
    --brand-amber: #F6B321;
    --brand-amber-soft: #FDE9BC;
    --brand-amber-ink: #3A2A00;
    --brand-pink: #E24AA6;

    --surface: #F1F5F9;
    --surface-card: #FFFFFF;
    --surface-alt: #F8FAFC;
    --border: #E2E8F0;

    --text: #0F172A;
    --text-muted: #64748B;
    --text-faint: #94A3B8;

    --status-online: #10B981;
    --status-busy: #F59E0B;
    --status-away: #94A3B8;
    --status-offline: #CBD5E1;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow-md: 0 10px 25px -8px rgba(15, 23, 42, 0.15);
    --shadow-lg: 0 20px 45px -12px rgba(15, 23, 42, 0.25);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--surface);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Fondo con "auras" de marca: sutiles, no compiten con el contenido. */
body.has-aura::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(480px 320px at 12% -5%, rgba(63, 27, 123, 0.16), transparent 60%),
        radial-gradient(420px 300px at 105% 15%, rgba(246, 179, 33, 0.16), transparent 60%),
        radial-gradient(360px 280px at 50% 115%, rgba(226, 74, 166, 0.10), transparent 60%);
}
/* Solo las secciones de contenido normal necesitan promoverse por encima del aura;
   los overlays de modal ya son position:fixed y deben quedar fuera de esta regla. */
body.has-aura > .topbar,
body.has-aura > .page-main,
body.has-aura > .admin-main { position: relative; z-index: 1; }

.font-brand { font-family: 'Montserrat', system-ui, sans-serif; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ---------- Header ---------- */
.topbar {
    background: var(--brand-purple);
    color: #fff;
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid rgba(246, 179, 33, 0.3);
}
.topbar-inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-inner.wide { max-width: 960px; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
    height: 36px; width: 36px;
    background: #fff; padding: 2px;
    border-radius: 10px; object-fit: contain;
    box-shadow: var(--shadow-md);
}
.topbar-title { font-weight: 800; font-size: 16px; line-height: 1; display: block; }
.topbar-subtitle {
    font-size: 9px; text-transform: uppercase; font-weight: 700;
    color: var(--brand-amber); letter-spacing: 0.08em;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-chip {
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
}
.btn-chip:hover { background: rgba(255,255,255,0.2); }
.btn-chip.accent { background: var(--brand-amber); color: var(--brand-amber-ink); border-color: transparent; }
.btn-chip.accent:hover { background: #f8bd3f; }

/* ---------- Card container ---------- */
.page-main {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card {
    width: 100%;
    max-width: 480px;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--brand-purple-soft);
    position: relative;
}
.card-banner {
    position: relative;
    height: 158px;
    padding: 18px;
    background: linear-gradient(115deg, var(--brand-purple) 0%, var(--brand-purple-dark) 55%, var(--brand-purple) 100%);
    /* Sin overflow:hidden aquí: el avatar (avatar-wrap) sobresale a propósito por debajo
       del banner para superponerse con el cuerpo de la tarjeta; el fondo del ::before
       ya queda contenido en su propia caja sin necesidad de recortar el banner. */
}
.card-banner::before {
    /* Glow ambar + textura de puntos sutil, para que el banner no se vea plano. */
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(140px 140px at 88% -10%, rgba(246, 179, 33, 0.35), transparent 70%),
        radial-gradient(circle, rgba(255,255,255,0.14) 1px, transparent 1px);
    background-size: auto, 16px 16px;
}

.avatar-wrap { position: absolute; bottom: -46px; left: 24px; }
.avatar-ring {
    padding: 3px; border-radius: 50%; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple));
    display: inline-block;
    position: relative;
}
.avatar-ring img {
    width: 104px; height: 104px; border-radius: 50%;
    object-fit: cover; display: block; background: var(--brand-purple-soft);
    border: 4px solid #fff;
}
.status-dot {
    position: absolute; bottom: 4px; right: 4px;
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: var(--shadow-md);
}
.status-dot.is-online { background: var(--status-online); }
.status-dot.is-busy { background: var(--status-busy); }
.status-dot.is-away { background: var(--status-away); }
.status-dot.is-offline { background: var(--status-offline); }
.status-dot.is-online::after {
    content: ""; position: absolute; inset: -2px; border-radius: 50%;
    border: 2px solid var(--status-online);
    animation: presence-pulse 2s ease-out infinite;
}
@keyframes presence-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.9); opacity: 0; }
}

.card-body { padding: 58px 24px 24px; display: flex; flex-direction: column; gap: 16px; }

.worker-name { font-size: 21px; font-weight: 800; line-height: 1.2; margin: 0; }
.title-badge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 800; color: var(--brand-purple);
    background: var(--brand-purple-soft);
    padding: 3px 10px; border-radius: 999px; margin: 6px 0 0;
}
.worker-dept { font-size: 12px; color: var(--text-muted); font-weight: 600; margin: 6px 0 0; }
.worker-company { font-size: 12px; color: var(--brand-purple); font-weight: 800; margin: 4px 0 0; }
.presence-label { font-size: 11px; font-weight: 700; margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; }
.presence-label.is-online { color: #059669; }
.presence-label.is-busy { color: #B45309; }
.presence-label.is-away, .presence-label.is-offline { color: var(--text-faint); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 800; font-size: 13px;
    border-radius: var(--radius-sm);
    border: none; cursor: pointer;
    height: 40px; padding: 0 14px;
    box-shadow: var(--shadow-md);
    transition: background-color .15s ease;
}
.btn-primary { background: var(--brand-purple); color: #fff; }
.btn-primary:hover { background: var(--brand-purple-dark); }
.btn-accent { background: var(--brand-amber); color: var(--brand-amber-ink); }
.btn-accent:hover { background: #f8bd3f; }
.btn-outline { background: var(--brand-purple-soft); color: var(--brand-purple); box-shadow: none; border: 1px solid rgba(63,27,123,0.15); }
.btn-outline:hover { background: rgba(63,27,123,0.14); }
.btn-icon { width: 40px; padding: 0; flex: 0 0 auto; }
.btn-block { width: 100%; }
.btn-row { display: flex; align-items: center; gap: 8px; }
.btn-row .btn-grow { flex: 1 1 0; }

/* ---------- Contact info ---------- */
.contact-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    padding-top: 10px; border-top: 1px solid var(--border);
    font-size: 12px; font-weight: 500;
}
.contact-chip {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--surface-alt);
    transition: transform .12s ease, border-color .12s ease, background-color .12s ease;
}
a.contact-chip:hover { background: #fff; border-color: var(--brand-purple-soft); transform: translateY(-1px); }
.contact-chip-wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.contact-icon.linkedin { background: #0A66C2; color: #fff; font-weight: 900; font-size: 13px; font-style: normal; }
.contact-shared {
    display: flex; align-items: center; gap: 10px;
    font-size: 11px; color: var(--text-muted); font-weight: 600;
}

/* Legado: fila de contacto de ancho completo (aún usada por otras vistas). */
.contact-list { display: flex; flex-direction: column; gap: 10px; font-size: 12px; font-weight: 500; }
.contact-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
a.contact-row:hover { background: var(--surface-alt); border-color: var(--border); }
.contact-row.static { background: var(--surface-alt); border-color: var(--border); }

.contact-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.contact-icon.emerald { background: #D1FAE5; color: #047857; }
.contact-icon.purple { background: var(--brand-purple-soft); color: var(--brand-purple); }
.contact-icon.amber { background: var(--brand-amber-soft); color: #92600A; }
.contact-label { font-size: 10px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; display: block; }
.contact-value { font-weight: 700; color: var(--text); word-break: break-word; }

.bio-quote {
    font-size: 12px; color: var(--text-muted); background: var(--surface-alt);
    padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--border);
    line-height: 1.5; font-style: italic; margin: 0;
}

.card-footer {
    padding: 12px; background: var(--surface-alt); border-top: 1px solid var(--border);
    text-align: center; font-size: 10px; color: var(--text-muted); font-weight: 600;
}

/* ---------- Directorio de la empresa (raíz del sitio sin ?ext) ---------- */
.directory-main { align-items: flex-start; padding-top: 40px; }
.directory-wrap { width: 100%; max-width: 560px; margin: 0 auto; }
.directory-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; text-align: center; }
.directory-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin: 0 0 24px; }
.directory-grid { display: flex; flex-direction: column; gap: 10px; }
.directory-item {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface-card); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px 16px;
    box-shadow: var(--shadow-md);
    transition: transform .12s ease, border-color .12s ease;
}
.directory-item:hover { transform: translateY(-2px); border-color: var(--brand-purple-soft); }
.directory-photo {
    width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--brand-amber); flex: 0 0 auto; background: var(--brand-purple-soft);
}
.directory-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.directory-name { font-weight: 800; font-size: 14px; color: var(--text); font-family: 'Montserrat', system-ui, sans-serif; }
.directory-role { font-size: 12px; color: var(--brand-purple); font-weight: 600; }
.directory-arrow { color: var(--text-faint); flex: 0 0 auto; display: flex; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: #fff; border-radius: var(--radius-lg);
    max-width: 420px; width: 100%; padding: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    display: flex; flex-direction: column; gap: 16px;
    max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 560px; }
.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: none; border: none; cursor: pointer;
    color: var(--text-faint); font-weight: 700; font-size: 16px;
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 16px; font-weight: 800; margin: 0; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 11px; font-weight: 700; color: #334155; }
.field input, .field textarea, .field select {
    width: 100%; padding: 9px 12px;
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    font-family: inherit; color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; box-shadow: 0 0 0 2px var(--brand-purple);
    border-color: var(--brand-purple);
}
.field-hint { font-size: 11px; color: var(--text-faint); }
.field-error { font-size: 11px; color: #E11D48; font-weight: 700; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.alert { padding: 14px; border-radius: var(--radius-md); font-size: 12px; font-weight: 700; }
.alert-success { background: #D1FAE5; border: 1px solid #6EE7B7; color: #065F46; }
.alert-error { background: #FFE4E6; border: 1px solid #FDA4AF; color: #9F1239; }

/* ---------- Admin layout ---------- */
.admin-main { max-width: 960px; margin: 0 auto; padding: 32px 16px; width: 100%; }
.panel {
    background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(15,23,42,0.05); padding: 24px;
    display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 18px; font-weight: 800; margin: 0; }
.panel-subtitle { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

.workers-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .workers-grid { grid-template-columns: 1fr 1fr; } }

.worker-card {
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 16px;
    display: flex; flex-direction: column; gap: 12px; position: relative;
}
.worker-card-head { display: flex; align-items: flex-start; gap: 12px; }
.worker-card-photo {
    width: 56px; height: 56px; border-radius: var(--radius-sm);
    object-fit: cover; border: 2px solid var(--brand-amber);
    background: var(--surface);
}
.worker-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill { padding: 2px 8px; background: var(--brand-purple-soft); color: var(--brand-purple); font-weight: 900; font-size: 11px; border-radius: 6px; }

.url-box {
    padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.url-box code { font-family: monospace; font-weight: 700; color: var(--brand-purple); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.link-danger { font-size: 12px; color: #E11D48; font-weight: 700; background: none; border: none; cursor: pointer; padding: 0; }
.link-danger:hover { text-decoration: underline; }

.card-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 700; color: var(--brand-purple);
    background: none; border: none; cursor: pointer; padding: 0;
}
.card-link:hover { text-decoration: underline; }

.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qr-item { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr-item img {
    width: 100%; max-width: 180px; aspect-ratio: 1 / 1;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px;
}
.qr-caption { font-size: 11px; color: var(--text-muted); font-weight: 600; margin: 0; line-height: 1.4; }

/* ---------- QR a pantalla completa (para que el colaborador lo muestre a un cliente) ---------- */
.qr-fullscreen {
    position: fixed; inset: 0; z-index: 60;
    background: #fff; color: var(--text);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 20px; padding: 24px;
}
.qr-fullscreen.hidden { display: none; }
.qr-fullscreen-close {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--surface-alt); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text); cursor: pointer;
}
.qr-fullscreen-heading { text-align: center; }
.qr-fullscreen-heading h3 { margin: 0; font-size: 18px; font-weight: 800; }
.qr-fullscreen-heading p { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.qr-fullscreen-image {
    width: min(78vw, 78vh); height: min(78vw, 78vh);
    object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px;
}
.qr-fullscreen-tabs { display: flex; gap: 8px; background: var(--surface-alt); padding: 4px; border-radius: 999px; }
.qr-fullscreen-tab {
    border: none; background: none; cursor: pointer;
    padding: 8px 16px; border-radius: 999px;
    font-size: 12px; font-weight: 700; color: var(--text-muted);
}
.qr-fullscreen-tab.active { background: var(--brand-purple); color: #fff; }

table.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.data-table thead tr { background: var(--surface-alt); color: #334155; border-bottom: 1px solid var(--border); }
.data-table th, .data-table td { padding: 10px 12px; }
.data-table tbody tr { border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: var(--surface-alt); }
.table-scroll { overflow-x: auto; }

.login-wrap { max-width: 420px; margin: 0 auto; }
.login-card { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--brand-purple-soft); box-shadow: var(--shadow-lg); overflow: hidden; }
.login-head {
    background: linear-gradient(90deg, var(--brand-purple), var(--brand-purple-dark), var(--brand-purple));
    padding: 24px; text-align: center; color: #fff;
}
.login-badge {
    width: 48px; height: 48px; border-radius: var(--radius-md);
    background: var(--brand-amber); color: var(--brand-amber-ink);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px; font-weight: 800; font-size: 20px; box-shadow: var(--shadow-md);
}
.login-form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
