/* ===================================================================
   Junin Services — Site.css  (Bootstrap 5 base)
   Incluye: landing pública + app shell de documentos + componentes
   =================================================================== */

/* ── Variables ────────────────────────────────────────────────────── */
:root {
    --js-green:       #19a050;
    --js-green-dark:  #117a3a;
    --js-green-light: #d4edda;
    --js-bg-dark:     #0b0c10;
    --js-sidebar-w:   220px;
    --js-topbar-h:    56px;
    --bs-body-color:         #212529;
    --bs-secondary-color:    #495057;
    --bs-tertiary-color:     #6c757d;
}

html { scroll-behavior: smooth; }

/* ── Tipografía global ────────────────────────────────────────────── */
.text-body-secondary { color: #495057 !important; }
.text-muted          { color: #6c757d !important; }
small, .small        { color: inherit; }

/* ── Inputs — quitar límite heredado de bootstrap antiguo ─────────── */
input, select, textarea { max-width: 100%; }

/* ================================================================
   LANDING / PÁGINA PÚBLICA
   ================================================================ */

/* Hero */
.hero-bg {
    background: linear-gradient(160deg, rgba(0,0,0,.48), rgba(11,12,16,.52)),
                url('/Images/hero.jpg') center/cover no-repeat;
    color: #f2f6f8;
    padding-top: 6rem;
    padding-bottom: 5rem;
}
.hero-bg .lead      { color: #dbe3e8 !important; }
.hero-bg .btn       { box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* Tarjetas de servicios */
.card-img-top {
    aspect-ratio: 3 / 2;
    object-fit: cover;
    width: 100%;
    height: auto;
}
.card.h-100 .card-body { min-height: 170px; }

/* "Cómo funciona" */
#como-funciona .p-3 {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

/* Badges de número */
.num-badge {
    width: 34px; height: 34px;
    border-radius: .6rem;
    display: grid; place-items: center;
    font-weight: 700;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(0,0,0,.04);
    color: #6c757d;
}
.num-badge2 {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 12px;
    border-radius: .6rem;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(0,0,0,.03);
    color: #6c757d;
    font-size: .8rem;
}

.tracking { letter-spacing: .12em; }
.kpi {
    padding: .35rem .25rem;
    border-radius: .5rem;
    background: rgba(255,255,255,.06);
}

/* Galería de vídeos */
.insta-thumb {
    position: relative;
    overflow: hidden;
    display: block;
    border-radius: 1rem;
    cursor: pointer;
    background: #000;
}
.insta-thumb img {
    aspect-ratio: 1/1;
    object-fit: cover;
    transition: transform .4s ease, filter .4s ease;
}
.insta-thumb::after {
    content: "";
    position: absolute;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #fff;
    font-size: 2rem;
    opacity: 0;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    transition: opacity .4s ease;
}
.insta-thumb:hover img   { transform: scale(1.08); filter: brightness(.7); }
.insta-thumb:hover::after { opacity: 1; }
.insta-thumb .insta-play-icon {
    font-size: 2rem; line-height: 1;
    color: rgba(255,255,255,.9);
    text-shadow: 0 2px 8px rgba(0,0,0,.6);
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.insta-thumb.paused .insta-play-icon { opacity: 1; }
.insta-video { object-fit: cover; }
@media (hover:hover) and (pointer:fine) {
    .insta-thumb:hover .insta-play-icon { opacity: 0; }
}

/* ================================================================
   APP SHELL (zona de documentos)
   ================================================================ */

body.app-shell {
    background: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────────────────── */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    height: var(--js-topbar-h);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.app-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1rem;
}

/* Brand */
.app-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    color: #212529;
    text-decoration: none;
    white-space: nowrap;
    font-size: .95rem;
}
.app-brand:hover { color: var(--js-green); }

/* Nav */
.app-nav {
    display: flex;
    gap: .25rem;
    flex: 1;
}
.app-nav-link {
    padding: .35rem .75rem;
    border-radius: .4rem;
    font-size: .875rem;
    font-weight: 500;
    color: #495057;
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.app-nav-link:hover,
.app-nav-link.active {
    background: #f0faf4;
    color: var(--js-green);
}
.app-nav-link.active { font-weight: 600; }

/* User menu */
.app-user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Hamburger (mobile) */
.app-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}
.app-nav-toggle span {
    display: block;
    width: 22px; height: 2px;
    background: #212529;
    border-radius: 2px;
    transition: transform .2s;
}

/* ── Contenido principal ─────────────────────────────────────────── */
.app-main {
    flex: 1;
    padding: 1.5rem 0 3rem;
}
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ── Mobile nav ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .app-nav-toggle { display: flex; }
    .app-user-menu  { order: 3; margin-left: 0; }
    .app-nav {
        display: none;
        position: absolute;
        top: var(--js-topbar-h);
        left: 0; right: 0;
        background: #fff;
        border-bottom: 1px solid #e9ecef;
        flex-direction: column;
        padding: .75rem 1rem;
        gap: .25rem;
        box-shadow: 0 4px 12px rgba(0,0,0,.08);
        z-index: 1029;
    }
    .app-nav.open { display: flex; }
    .app-topbar-inner { flex-wrap: wrap; }
}

/* ================================================================
   COMPONENTES COMPARTIDOS
   ================================================================ */

/* ── Page header ─────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}
.page-header h1,
.page-header h2 { margin: 0; font-size: 1.4rem; font-weight: 700; }

/* ── Tarjetas de documento ───────────────────────────────────────── */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.doc-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.doc-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

.doc-card-head {
    padding: .85rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.doc-card-title {
    font-weight: 700;
    font-size: .9rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-card-body  { padding: .85rem 1rem; flex: 1; }
.doc-card-foot  {
    padding: .7rem 1rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.doc-card-id { color: #adb5bd; font-size: .75rem; }
.doc-meta    { font-size: .8rem; color: #6c757d; line-height: 1.6; margin: 0; }

/* ── Estado badges ───────────────────────────────────────────────── */
.badge-estado {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 2rem;
    font-size: .72rem;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-estado.rascunho {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}
.badge-estado.emitido {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* ── Detalle de documento ────────────────────────────────────────── */
.doc-detail-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.doc-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.doc-meta-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .3rem .75rem;
    font-size: .875rem;
}
.doc-meta-grid dt { color: #6c757d; font-weight: 500; }
.doc-meta-grid dd { margin: 0; }

/* ── Acciones de documento ───────────────────────────────────────── */
.doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    align-items: center;
}

/* ── Formularios ─────────────────────────────────────────────────── */
.form-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    padding: 1.5rem;
    max-width: 720px;
}

/* ── QR panel ────────────────────────────────────────────────────── */
.qr-panel {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: .6rem;
    padding: 1rem;
    text-align: center;
}
.qr-panel img { max-width: 160px; }
.qr-panel .qr-url {
    font-size: .72rem;
    word-break: break-all;
    color: #6c757d;
    margin-top: .5rem;
}

/* ── Texto de documento (PDF preview) ───────────────────────────── */
.doc-texto {
    white-space: pre-wrap;
    font-family: "Segoe UI", sans-serif;
    font-size: .9rem;
    line-height: 1.7;
    background: #fafafa;
    border: 1px solid #e9ecef;
    border-radius: .4rem;
    padding: 1rem;
}

/* ── Hash badge ──────────────────────────────────────────────────── */
.hash-code {
    font-family: "Courier New", monospace;
    font-size: .7rem;
    word-break: break-all;
    color: #6c757d;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: .3rem;
    padding: .2rem .4rem;
    display: block;
}

/* ── Aviso de documento emitido ──────────────────────────────────── */
.doc-emitido-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: .5rem;
    padding: .75rem 1rem;
    color: #155724;
    font-size: .875rem;
    margin-bottom: 1rem;
}
.doc-rascunho-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: .5rem;
    padding: .75rem 1rem;
    color: #856404;
    font-size: .875rem;
    margin-bottom: 1rem;
}

/* ================================================================
   ASISTENTE IA FLOTANTE
   ================================================================ */

.ia-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--js-green);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    z-index: 2000;
    transition: background .15s, transform .15s;
}
.ia-fab:hover { background: var(--js-green-dark); transform: scale(1.07); }

.ia-panel {
    position: fixed;
    bottom: 4.5rem;
    right: 1.5rem;
    width: 360px;
    max-height: 560px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: .9rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.14);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    overflow: hidden;
    transition: opacity .2s, transform .2s;
}
.ia-panel.ia-hidden {
    opacity: 0;
    transform: translateY(12px) scale(.97);
    pointer-events: none;
}

.ia-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--js-green);
    color: #fff;
}
.ia-panel-head h6 { margin: 0; font-size: .9rem; font-weight: 600; }
.ia-panel-head button {
    background: none; border: none; color: rgba(255,255,255,.8);
    cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.ia-panel-head button:hover { color: #fff; }

.ia-messages {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.ia-msg {
    max-width: 85%;
    padding: .5rem .75rem;
    border-radius: .6rem;
    font-size: .82rem;
    line-height: 1.5;
}
.ia-msg.ia-msg-bot  { background: #f0faf4; color: #1a3a28; align-self: flex-start; }
.ia-msg.ia-msg-user { background: #e8f0fe; color: #1a2a4a; align-self: flex-end; }

.ia-input-row {
    display: flex;
    gap: .4rem;
    padding: .6rem .75rem;
    border-top: 1px solid #f0f0f0;
    align-items: flex-end;
}
.ia-input-row textarea {
    flex: 1;
    resize: none;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    padding: .4rem .6rem;
    font-size: .82rem;
    min-height: 38px;
    max-height: 100px;
    font-family: inherit;
}
.ia-input-row textarea:focus { outline: none; border-color: var(--js-green); }

.ia-btn-mic,
.ia-btn-send {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .95rem;
    transition: background .15s;
    flex-shrink: 0;
}
.ia-btn-mic  { background: #f0f0f0; color: #555; }
.ia-btn-mic:hover          { background: #e0e0e0; }
.ia-btn-mic.ia-mic-active  { background: #dc3545; color: #fff; }
.ia-btn-send { background: var(--js-green); color: #fff; }
.ia-btn-send:hover { background: var(--js-green-dark); }

.ia-typing {
    font-size: .78rem;
    color: #6c757d;
    padding: 0 1rem .4rem;
    min-height: 1.2rem;
}

@media (max-width: 440px) {
    .ia-panel { right: .5rem; left: .5rem; width: auto; }
}
