/* === SUBCARPETA AISLADA v2.2.7: FIX DEFINITIVO DE ALTURA EN MODAL + PANEL AZUL/TURQUESA CON OLAS Y BURBUJAS === */

/* 1. FIX CRITICO: Evita que CSS Grid comprima bloques con overflow:hidden dentro del modal */
#modalDeviceBody.modal-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    padding: 18px 22px 22px !important;
}
#modalDeviceBody.modal-body > * {
    flex-shrink: 0 !important;
    width: 100%;
}

/* 2. Tarjeta Ejecutiva Unificada: Telemetria + Ilustracion Dinamica del Telefono + Barra PIN */
.idv-device-overview-card {
    background: linear-gradient(180deg, #FFFFFF 0%, #F5FBFF 100%);
    border: 1.5px solid #C6E2F4;
    border-radius: 20px;
    padding: 16px 18px 14px;
    box-shadow: 0 8px 22px rgba(10, 37, 64, 0.06);
    display: flex;
    flex-direction: column;
    gap: 13px;
}
body.dark-mode .idv-device-overview-card {
    background: linear-gradient(180deg, #102847 0%, #0B1D35 100%);
    border-color: rgba(60, 226, 236, 0.24);
}

.idv-overview-split {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) 150px;
    align-items: center;
    gap: 14px;
}

.idv-spec-rows {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
}
.idv-spec-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 12px;
    background: rgba(27, 111, 184, 0.05);
    border: 1px solid rgba(28, 163, 200, 0.16);
}
body.dark-mode .idv-spec-item {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(60, 226, 236, 0.16);
}
.idv-spec-ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(28, 163, 200, 0.14);
    color: #1668B2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.84rem;
    font-weight: 900;
    flex-shrink: 0;
}
body.dark-mode .idv-spec-ico {
    background: rgba(60, 226, 236, 0.15);
    color: #3CE2EC;
}
.idv-spec-txt {
    min-width: 0;
}
.idv-spec-lbl {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}
.idv-spec-val {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ilustracion 3D suave del Smartphone en vivo (Verde/Turquesa, Rojo o Ambar como en 3.47.24 PM) */
.idv-phone-visual-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.idv-phone-mockup {
    width: 76px;
    height: 126px;
    border-radius: 15px;
    border: 3.5px solid #1E293B;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: rotate(5deg);
    box-shadow: 0 12px 24px rgba(10, 37, 64, 0.18);
    transition: transform 0.2s ease;
}
.idv-phone-mockup:hover {
    transform: rotate(0deg) scale(1.04);
}
.idv-phone-mockup::before {
    content: '';
    position: absolute;
    top: 6px;
    width: 22px;
    height: 3.5px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.55);
}
.idv-phone-mockup.ph-active {
    background: linear-gradient(160deg, #1294B8 0%, #10B981 100%);
    color: #FFFFFF;
}
.idv-phone-mockup.ph-locked {
    background: linear-gradient(160deg, #B91C1C 0%, #EF4444 100%);
    color: #FFFFFF;
}
.idv-phone-mockup.ph-pending {
    background: linear-gradient(160deg, #F59E0B 0%, #EA8806 100%);
    color: #1E293B;
}
.idv-phone-mockup-cap {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Franja compacta del PIN Maestro Offline integrada al pie de telemetria */
.idv-compact-pin-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 14px;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(23, 98, 176, 0.08), rgba(34, 199, 214, 0.12));
    border: 1px solid rgba(28, 163, 200, 0.30);
}
.idv-pin-dots-box {
    font-family: Consolas, monospace;
    font-size: 1.12rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--primary);
    background: var(--bg-panel);
    padding: 4px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
}
body.dark-mode .idv-pin-dots-box {
    color: #3CE2EC;
}

/* 3. GRAN PANEL AZUL OCEANO Y TURQUESA CON OLAS MULTICAPA Y BURBUJAS VIVAS (ESTILO FDL + IDEVIOS) */
.idv-actions-launchpad-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    background: linear-gradient(180deg, #1B8CE0 0%, #156EC0 45%, #0F5298 85%, #0B3E78 100%);
    border: 1.5px solid rgba(94, 238, 250, 0.48);
    box-shadow: 0 16px 36px rgba(11, 58, 112, 0.28);
    padding: 0 0 24px;
    min-height: 410px;
    color: #FFFFFF;
}
body.dark-mode .idv-actions-launchpad-wrap {
    background: linear-gradient(180deg, #146EB8 0%, #0E4F8E 50%, #082F5C 100%);
    border-color: rgba(60, 226, 236, 0.45);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.50);
}

/* Cresta superior de olas cristalinas estilo 3.47.24 PM */
.idv-actions-wave-crest {
    position: relative;
    width: 100%;
    height: 44px;
    background: var(--bg-panel);
    line-height: 0;
    z-index: 2;
}
.idv-actions-wave-crest svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Capa interna de burbujas blancas/turquesa flotando sobre el fondo azul */
.idv-panel-bubbles-layer {
    position: absolute;
    inset: 44px 0 0 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}
body.bubbles-paused .idv-panel-bubbles-layer {
    display: none !important;
}
.idv-panel-bubble {
    position: absolute;
    bottom: -55px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.46), rgba(94, 242, 250, 0.18) 65%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.30);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.35);
    animation: idvPanelBubbleRise linear infinite;
}

@keyframes idvPanelBubbleRise {
    0% {
        transform: translate3d(0, 0, 0) scale(0.82);
        opacity: 0;
    }
    14% {
        opacity: 0.85;
    }
    85% {
        opacity: 0.55;
    }
    100% {
        transform: translate3d(var(--p-sway, 20px), -520px, 0) scale(1.15);
        opacity: 0;
    }
}

/* Cabecera blanca/turquesa dentro del panel azul */
.idv-actions-head {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 22px 16px;
}
.idv-actions-title {
    font-size: 1rem;
    font-weight: 900;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 3px rgba(4, 20, 42, 0.30);
}
.idv-actions-sub {
    font-size: 0.77rem;
    color: rgba(230, 246, 255, 0.88);
    font-weight: 600;
    margin-top: 2px;
}
.idv-actions-count-pill {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(4px);
    color: #FFFFFF;
    font-size: 0.73rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 999px;
}

/* Cuadricula de los 20 Botones Circulares sobre el panel azul */
.idv-ficha-orb-grid {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px 10px;
    padding: 4px 16px 4px;
}

.idv-ficha-orb-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 2px;
    color: #FFFFFF;
    outline: none;
}
.idv-ficha-orb-btn:hover .idv-ficha-orb-circle {
    transform: translateY(-3px) scale(1.07);
    background: rgba(255, 255, 255, 0.26);
    border-color: #67F2FC;
    box-shadow: 0 10px 22px rgba(4, 22, 46, 0.34), 0 0 14px rgba(103, 242, 252, 0.36);
}
.idv-ficha-orb-btn:active .idv-ficha-orb-circle {
    transform: scale(0.93);
}

.idv-ficha-orb-circle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: 1.6px solid rgba(255, 255, 255, 0.46);
    box-shadow: 0 6px 15px rgba(5, 25, 52, 0.24);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    transition: all 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.idv-ficha-orb-circle svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Variantes destacadas para Refresh y Funciones Pro */
.idv-ficha-orb-circle.orb-turq-accent {
    background: linear-gradient(145deg, rgba(56, 228, 242, 0.36), rgba(20, 184, 166, 0.32));
    border-color: #7CF7FF;
}
.idv-ficha-orb-circle.orb-pro-stealth {
    background: linear-gradient(145deg, rgba(60, 226, 236, 0.32), rgba(14, 116, 144, 0.42));
    border-color: #67F2FC;
}
.idv-ficha-orb-circle.orb-amber-siren {
    background: linear-gradient(145deg, #FB9B2A, #EA7B12);
    border-color: rgba(255, 255, 255, 0.68);
}

.idv-orb-status-pill {
    position: absolute;
    top: -4px;
    right: -5px;
    background: #10B981;
    color: #FFFFFF;
    font-size: 0.60rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1.5px solid #0E589F;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}
.idv-orb-status-pill.pill-pro {
    background: #06B6D4;
}
.idv-orb-status-pill.pill-warn {
    background: #F59E0B;
}

.idv-ficha-orb-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #FFFFFF;
    text-align: center;
    line-height: 1.2;
    max-width: 106px;
    text-shadow: 0 1px 2px rgba(4, 20, 42, 0.35);
}

/* === HOJA / SUB-PANEL EMERGENTE AL PULSAR CUALQUIER BOTON CIRCULAR === */
.idv-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1650;
    background: rgba(5, 22, 42, 0.64);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: idvSheetFadeIn 0.16s ease-out;
}
@keyframes idvSheetFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.idv-sheet-window {
    width: 100%;
    max-width: 540px;
    max-height: 88vh;
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 24px 58px rgba(4, 16, 32, 0.48);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: idvSheetSlideUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes idvSheetSlideUp {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.idv-sheet-header {
    background: linear-gradient(95deg, #13549C 0%, #1B8EC4 58%, #24BFD0 100%);
    color: #FFFFFF;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.idv-sheet-h-title {
    font-size: 1.02rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 9px;
}
.idv-sheet-h-sub {
    font-size: 0.75rem;
    opacity: 0.92;
    margin-top: 2px;
}
.idv-sheet-close-btn {
    background: rgba(255, 255, 255, 0.18);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}
.idv-sheet-close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.idv-sheet-body {
    padding: 18px 20px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.idv-sheet-seg-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: var(--bg-input);
    border: 1.5px solid #C4E1F3;
    border-radius: 14px;
    padding: 5px;
    flex-shrink: 0;
}
body.dark-mode .idv-sheet-seg-bar {
    background: #08182E;
    border-color: rgba(60, 226, 236, 0.28);
}
.idv-sheet-seg-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 6px;
    border-radius: 10px;
    font-size: 0.77rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s ease;
}
.idv-sheet-seg-btn.active {
    background: linear-gradient(135deg, #135BA6, #20B8D0);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(21, 98, 175, 0.28);
}

.idv-sheet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    cursor: pointer;
}
.idv-sheet-row:hover {
    border-color: var(--turquoise);
}
.idv-sheet-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #1988C4;
    cursor: pointer;
    flex-shrink: 0;
}
.idv-sheet-row-main {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}
.idv-sheet-row-title {
    font-size: 0.87rem;
    font-weight: 800;
    color: var(--text-main);
}
.idv-sheet-row-desc {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.idv-app-brand-ico {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.idv-app-brand-ico svg {
    width: 18px;
    height: 18px;
}

.idv-wp-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.idv-wp-card {
    border: 2px solid var(--border-soft);
    border-radius: 14px;
    padding: 7px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-input);
    transition: all 0.15s ease;
}
.idv-wp-card.selected {
    border-color: #1CA3C8;
    background: rgba(34, 199, 214, 0.10);
    box-shadow: 0 6px 16px rgba(28, 163, 200, 0.20);
}
.idv-wp-screen {
    height: 92px;
    border-radius: 9px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    font-size: 0.58rem;
    font-weight: 800;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.idv-wp-screen.wp-1 { background: linear-gradient(165deg, #0D4B8C, #1CA3C8 65%, #38E4F2); color: #FFFFFF; }
.idv-wp-screen.wp-2 { background: linear-gradient(165deg, #FEF3C7, #F59E0B 75%, #EA580C); color: #1E293B; }
.idv-wp-screen.wp-3 { background: linear-gradient(165deg, #0F172A, #1E293B 65%, #091526); color: #38E4F2; }
.idv-wp-screen.wp-4 { background: #05080F; color: #FFFFFF; border: 1px solid #334155; }
.idv-wp-lbl {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--text-main);
}

.idv-sheet-note {
    font-size: 0.76rem;
    color: var(--text-muted);
    background: rgba(27, 111, 184, 0.08);
    border: 1px solid rgba(28, 163, 200, 0.25);
    border-radius: 12px;
    padding: 10px 12px;
    line-height: 1.4;
}

@media (max-width: 680px) {
    .idv-overview-split {
        grid-template-columns: 1fr;
    }
    .idv-spec-rows {
        grid-template-columns: 1fr;
    }
    .idv-phone-visual-box {
        display: none;
    }
    .idv-ficha-orb-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px 6px;
        padding: 4px 10px 0;
    }
    .idv-ficha-orb-circle {
        width: 52px;
        height: 52px;
    }
    .idv-ficha-orb-circle svg {
        width: 24px;
        height: 24px;
    }
    .idv-ficha-orb-label {
        font-size: 0.70rem;
    }
    .idv-wp-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
