/* =========================================================
   ESCANEAR QR
   SISTEMA DE CONTROL DE ACCESO
========================================================= */

.scanner-page {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: 24px;
    align-items: start;
}


/* =========================================================
   TARJETAS
========================================================= */

.scanner-card,
.person-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}


/* =========================================================
   ENCABEZADO DE TARJETAS
========================================================= */

.scanner-header {
    padding: 24px 26px 20px;
    border-bottom: 1px solid #eeeeee;
}

.scanner-header h2 {
    margin: 0 0 7px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.scanner-header p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
}


/* =========================================================
   LECTOR QR
========================================================= */

.reader-container {
    width: calc(100% - 52px);
    margin: 24px auto 18px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    box-sizing: border-box;
}

#reader {
    width: 100%;
    max-width: 520px;
    min-height: 280px;
    margin: 0 auto;
    border: none !important;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}


/* =========================================================
   ELEMENTOS GENERADOS POR HTML5 QR CODE
========================================================= */

#reader video {
    width: 100% !important;
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

#reader img {
    max-width: 100%;
}

#reader__scan_region {
    border-radius: 8px;
    overflow: hidden;
}

#reader__dashboard {
    width: 100% !important;
    padding: 10px 0 0 !important;
}

#reader__dashboard_section {
    padding: 0 !important;
}

#reader__dashboard_section_csr {
    margin-top: 8px;
}

#reader__dashboard button {
    background: #111827 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 7px !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
    cursor: pointer;
}

#reader__dashboard button:hover {
    background: #000000 !important;
}

#reader__dashboard select {
    border: 1px solid #d1d5db !important;
    border-radius: 7px !important;
    padding: 8px 10px !important;
    background: #ffffff !important;
    color: #111827 !important;
}


/* =========================================================
   ESTADO DEL ESCÁNER
========================================================= */

.scanner-status {
    width: calc(100% - 52px);
    margin: 0 auto 18px;
    padding: 11px 14px;
    box-sizing: border-box;
    border-radius: 7px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    text-align: center;
    line-height: 1.4;
}


/* =========================================================
   BOTONES DEL ESCÁNER
========================================================= */

.scanner-button {
    display: block;
    width: calc(100% - 52px);
    margin: 0 auto 10px;
    padding: 11px 18px;
    border: none;
    border-radius: 7px;
    background: #111827;
    color: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.scanner-button:hover {
    background: #000000;
}

.scanner-button:active {
    transform: translateY(1px);
}

.scanner-button.secondary {
    background: #6b7280;
}

.scanner-button.secondary:hover {
    background: #4b5563;
}


/* =========================================================
   FORMULARIO MANUAL
========================================================= */

.manual-form {
    margin-top: 20px;
    padding: 22px 26px 26px;
    border-top: 1px solid #eeeeee;
}

.manual-form label {
    display: block;
    margin-bottom: 9px;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
}

.manual-form-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
}

.manual-form input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    font-family: Arial, sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.manual-form input::placeholder {
    color: #9ca3af;
}

.manual-form input:focus {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.08);
}

.manual-form-row button {
    padding: 11px 18px;
    border: none;
    border-radius: 7px;
    background: #111827;
    color: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.manual-form-row button:hover {
    background: #000000;
}


/* =========================================================
   TARJETA PERSONA
========================================================= */

.person-card {
    min-height: 100%;
}


/* =========================================================
   PERFIL DE PERSONA
   Este bloque corresponde a la persona escaneada,
   NO al perfil del usuario del sistema.
========================================================= */

.person-profile {
    padding: 28px 25px 24px;
    text-align: center;
    border-bottom: 1px solid #eeeeee;
}

.person-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #111827;
    color: #ffffff;
    font-size: 25px;
    font-weight: 600;
    text-transform: uppercase;
}

.person-profile h2 {
    margin: 0 0 6px;
    color: #111827;
    font-size: 18px;
    font-weight: 600;
    word-break: break-word;
}

.person-profile p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}


/* =========================================================
   DATOS DE LA PERSONA
========================================================= */

.person-data {
    padding: 8px 25px 18px;
}

.person-data-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.person-data-item:last-child {
    border-bottom: none;
}

.person-data-item > span:first-child {
    color: #6b7280;
    font-weight: 400;
}

.person-data-item > span:last-child {
    color: #111827;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}


/* =========================================================
   ESTADO PERSONA
========================================================= */

.status-active,
.status-inactive {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px !important;
    font-weight: 600 !important;
}

.status-active {
    background: #ecfdf3;
    color: #15803d !important;
}

.status-inactive {
    background: #fef2f2;
    color: #dc2626 !important;
}


/* =========================================================
   ESTADO VACÍO
========================================================= */

.person-empty {
    min-height: 390px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-sizing: border-box;
    text-align: center;
}

.person-empty > div {
    max-width: 280px;
}

.person-empty div div {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    background: #f9fafb;
    color: #6b7280;
    font-size: 19px !important;
    font-weight: 600;
}

.person-empty p {
    margin: 0;
    color: #9ca3af;
    font-size: 13px;
    line-height: 1.6;
}


/* =========================================================
   ALERTAS
========================================================= */

.alert {
    position: relative;
    margin-bottom: 20px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.alert.exito {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.alert.salida {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.alert.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}


/* =========================================================
   EFECTOS DE LAS TARJETAS
========================================================= */

.scanner-card,
.person-card {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.scanner-card:hover,
.person-card:hover {
    border-color: #d9dce1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {
    .scanner-page {
        grid-template-columns: 1fr;
    }

    .scanner-card,
    .person-card {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .scanner-page {
        gap: 18px;
    }

    .scanner-header {
        padding: 20px;
    }

    .reader-container {
        width: calc(100% - 40px);
        padding: 12px;
    }

    .scanner-status {
        width: calc(100% - 40px);
    }

    .scanner-button {
        width: calc(100% - 40px);
    }

    .manual-form {
        padding: 20px;
    }

    .person-profile {
        padding: 24px 20px;
    }

    .person-data {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 520px) {
    .manual-form-row {
        grid-template-columns: 1fr;
    }

    .manual-form-row button {
        width: 100%;
    }

    .person-data-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .person-data-item > span:last-child {
        text-align: left;
    }

    .person-empty {
        min-height: 320px;
    }
}

@media (max-width: 400px) {
    .scanner-header h2 {
        font-size: 16px;
    }

    .scanner-header p {
        font-size: 12px;
    }

    .reader-container {
        width: calc(100% - 28px);
        margin-top: 16px;
    }

    .scanner-status {
        width: calc(100% - 28px);
    }

    .scanner-button {
        width: calc(100% - 28px);
    }

    .manual-form {
        padding: 18px 14px 20px;
    }

    .person-profile {
        padding-left: 14px;
        padding-right: 14px;
    }

    .person-data {
        padding-left: 14px;
        padding-right: 14px;
    }
}


/* =========================================================
   IMPRESIÓN
========================================================= */

@media print {
    .scanner-card {
        display: none;
    }

    .person-card {
        border: 1px solid #cccccc;
        box-shadow: none;
    }

    .person-empty {
        display: none;
    }
}


/* LOGO */
.logo {
    width: 100%;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    margin-bottom: 25px;
    flex-shrink: 0;
    overflow: hidden;
}
.logo-image {
    display: block;
    width: 115px;
    height: 115px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

/* =========================================================
   ADAPTACIÓN MÓVIL PARA SISTEMAQR
   ========================================================= */

html {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

.dashboard,
.main,
.content,
.scanner-page {
    min-width: 0;
    box-sizing: border-box;
}

.main {
    width: 100%;
    max-width: 100%;
}

.content {
    padding: 20px;
}

.scanner-page {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px;
    width: 100%;
    max-width: 100%;
    align-items: start;
}

.scanner-card,
.person-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.reader-container {
    width: calc(100% - 32px);
    max-width: 100%;
    margin: 18px auto;
    padding: 10px;
    box-sizing: border-box;
}

#reader {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    min-height: 180px;
    margin: 0 auto;
    box-sizing: border-box;
    overflow: hidden;
}

#reader video,
#reader canvas,
#reader img {
    max-width: 100% !important;
    box-sizing: border-box;
}

#reader video {
    display: block;
    height: auto;
    object-fit: cover;
}

#reader__scan_region {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

#reader__dashboard,
#reader__dashboard_section,
#reader__dashboard_section_csr {
    max-width: 100%;
    box-sizing: border-box;
}

#reader__dashboard select {
    max-width: 100%;
}

.scanner-status,
.scanner-button {
    width: calc(100% - 32px);
    max-width: 100%;
    box-sizing: border-box;
}

.scanner-status {
    overflow-wrap: anywhere;
}

.manual-form {
    min-width: 0;
    box-sizing: border-box;
}

.manual-form-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.manual-form input {
    min-width: 0;
}

.person-data-item {
    min-width: 0;
}

.person-data-item > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* TABLETAS Y TELÉFONOS */

@media (max-width: 900px) {
    .scanner-page {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .scanner-card,
    .person-card {
        max-width: 100%;
    }
}

/* TELÉFONOS */

@media (max-width: 600px) {
    .content {
        padding: 12px;
    }

    .scanner-page {
        gap: 14px;
    }

    .scanner-card,
    .person-card {
        border-radius: 14px;
    }

    .scanner-header {
        padding: 17px 16px;
    }

    .scanner-header h2 {
        font-size: 18px;
        line-height: 1.35;
    }

    .scanner-header p {
        font-size: 13px;
        line-height: 1.5;
    }

    .reader-container {
        width: calc(100% - 28px);
        margin: 14px auto;
        padding: 8px;
    }

    #reader {
        min-height: 150px;
    }

    .scanner-status,
    .scanner-button {
        width: calc(100% - 28px);
    }

    .scanner-status {
        margin-bottom: 12px;
        padding: 11px;
        text-align: left;
    }

    .scanner-button {
        min-height: 46px;
        margin-bottom: 10px;
        padding: 12px;
        font-size: 14px;
    }

    .manual-form {
        margin-top: 16px;
        padding: 17px 14px;
    }

    .manual-form label {
        font-size: 14px;
        line-height: 1.45;
    }

    .manual-form-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .manual-form input,
    .manual-form-row button {
        width: 100%;
        min-height: 46px;
        font-size: 14px;
        box-sizing: border-box;
    }

    .person-profile {
        padding: 22px 16px;
    }

    .person-avatar {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }

    .person-profile h2 {
        font-size: 17px;
        line-height: 1.4;
    }

    .person-data {
        padding: 8px 16px 14px;
    }

    .person-data-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        padding: 12px 0;
    }

    .person-data-item > span:last-child {
        text-align: left;
    }

    .person-empty {
        min-height: 180px;
        padding: 22px 16px;
    }

    .alert {
        overflow-wrap: anywhere;
        font-size: 13px;
    }
}

/* TELÉFONOS ESTRECHOS */

@media (max-width: 360px) {
    .content {
        padding: 8px;
    }

    .scanner-header {
        padding: 14px;
    }

    .reader-container {
        width: calc(100% - 20px);
    }

    .scanner-status,
    .scanner-button {
        width: calc(100% - 20px);
    }

    .manual-form {
        padding: 15px 10px;
    }

    .person-data {
        padding-right: 12px;
        padding-left: 12px;
    }
}