/* --- HOME COMMAND CENTER STYLES - SOLVENTA TECH ELITE v2 --- */

/* Las variables ahora se heredan del :root global en CSSLimpioEGL.css */

/* Hero Section */
.home-hero-section {
    background: var(--theme-hero-bg);
    color: var(--solvix-silver);
    padding: 40px 30px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    margin: 0 auto 20px auto;
    max-width: 1400px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.home-hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(var(--solvix-circuit) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

.home-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--solvix-silver);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

/* Alert Ticker */
.home-alert-ticker {
    background: rgba(185, 28, 28, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid #ef4444;
    color: #f87171;
    padding: 10px 20px;
    margin: 0 auto 20px auto;
    width: calc(100% - 30px);
    max-width: 1400px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 0 15px rgba(185, 28, 28, 0.1);
    backdrop-filter: blur(8px);
}

.ticker-label {
    font-weight: 900;
    margin-right: 15px;
    white-space: nowrap;
}

.ticker-text-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
}

.ticker-help-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.ticker-help-icon {
    font-size: 18px;
    cursor: help;
    color: #ef4444;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.ticker-help-icon:hover {
    opacity: 1;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.ticker-help-container .help-tooltip {
    bottom: 160%;
    left: 0;
    right: auto;
}

.ticker-help-container:hover .help-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ticker-scroll-area {
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
}

.ticker-text {
    display: inline-block;
    animation: tickerScroll 20s linear infinite;
}

@keyframes tickerScroll {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Dashboard Grid */
.home-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 0 10px 40px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.home-card {
    background: var(--solvix-glass);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    /* overflow: hidden removed to allow tooltips to show outside the card */
}

.home-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 242, 255, 0.1);
    border-color: rgba(0, 242, 255, 0.35);
    z-index: 10;
}

.home-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: var(--theme-card-title-margin);
    padding: var(--theme-card-title-padding);
    background: var(--theme-card-title-bg);
    border-bottom: var(--theme-card-title-border);
    border-radius: var(--theme-card-title-radius);
    box-shadow: var(--theme-card-title-shadow);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.card-icon-img {
    filter: brightness(1.2);
    transition: filter 0.3s;
}

.home-card:hover .card-icon-img {
    filter: brightness(1.6) drop-shadow(0 0 6px rgba(0, 242, 255, 0.6));
}

/* --- HELP TOOLTIPS - TECH ELITE CYAN --- */
.card-help-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 22px;
    height: 22px;
    background: rgba(0, 242, 255, 0.15);
    color: #00f2ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: help;
    transition: all 0.3s ease;
    z-index: 30;
    border: 1px solid rgba(0, 242, 255, 0.4);
    opacity: 0;
}

.home-card:hover .card-help-icon {
    opacity: 1;
}

.card-help-icon:hover {
    background: rgba(0, 242, 255, 0.3);
    color: #00f2ff;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

.help-tooltip {
    visibility: hidden;
    width: 240px;
    background-color: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    text-align: left;
    border-radius: 12px;
    padding: 15px;
    position: absolute;
    z-index: 100;
    bottom: 140%;
    right: -10px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: translateY(10px) scale(0.9);
    font-size: 0.8rem;
    line-height: 1.5;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 255, 0.15);
    pointer-events: none;
    border: 1px solid rgba(0, 242, 255, 0.3);
    backdrop-filter: blur(15px);
}

.card-help-icon:hover .help-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 18px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(0, 242, 255, 0.3) transparent transparent transparent;
}

/* Tooltip del gráfico: se abre hacia ABAJO porque el card tiene overflow:hidden */
.chart-card .help-tooltip {
    bottom: auto;
    top: 140%;
    transform: translateY(-10px) scale(0.9);
}

.chart-card .card-help-icon:hover .help-tooltip {
    transform: translateY(0) scale(1);
}

.chart-card .help-tooltip::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent rgba(0, 242, 255, 0.3) transparent;
}

/* Toggle Switches (Panel Ajustes Flujo) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .4s;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    
  border-color: rgba(0, 242, 255, 0.5);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: #00f2ff;
    box-shadow: 0 0 6px rgba(0, 242, 255, 0.6);
}

/* Pulse Widget */
.pulse-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pulse-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.pulse-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.pulse-icon {
    font-size: 1.5rem;
    margin-right: 15px;
}

.pulse-label {
    flex: 1;
    font-weight: 600;
    color: var(--solvix-silver);
}

.pulse-val {
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.status-green .pulse-icon {
    color: #16a34a;
}

.status-green .pulse-val {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-yellow .pulse-icon {
    color: #ca8a04;
}

.status-yellow .pulse-val {
    background: rgba(202, 138, 4, 0.2);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.3);
}

.status-red .pulse-icon {
    color: #dc2626;
}

.status-red .pulse-val {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-blue .pulse-icon {
    color: #2563eb;
}

.status-blue .pulse-val {
    background: #dbeafe;
    color: #1e40af;
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border-radius: 12px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.quick-btn:hover {
    transform: translateY(-2px);
    filter: brightness(120%);
}

#card-chart {
    background: var(--theme-chart-bg);
    color: var(--theme-chart-color);
}

.footer-info {
    background: var(--theme-footer-bg);
    border-radius: var(--theme-footer-radius);
    padding: var(--theme-footer-padding);
    border-top: var(--theme-footer-border);
    transition: background 0.3s, border-radius 0.3s, padding 0.3s;
}

/* Fin de home-new.css */

/* === CHAT DE EQUIPO (card-activity-msj) === */
#card-activity-msj {
    display: flex;
    flex-direction: column;
    position: relative;
}

.msj-notif-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 22px;
    height: 22px;
    background: #3b82f6; /* Azul para mensajes directos */
    color: #fff;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid rgba(10, 15, 30, 0.8);
    z-index: 20;
    animation: msj-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msj-badge-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.msj-chat-body::-webkit-scrollbar { width: 4px; }
.msj-chat-body::-webkit-scrollbar-track { background: transparent; }
.msj-chat-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.msj-chat-body {
    background: transparent;
    border-radius: 12px;
    padding: 10px !important;
}

/* Solo en Tema Corporativo: Fondo oscuro y burbujas blancas */
[data-theme="corporate"] .msj-chat-body {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.msj-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.4;
    max-width: 85%;
    word-break: break-word;
    animation: fadeIn 0.3s ease;
}

.msj-bubble-mine {
    align-self: flex-end;
    background: rgba(0, 242, 255, 0.15);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-bottom-right-radius: 3px;
    color: #e2e8f0;
}

.msj-bubble-other {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 3px;
    color: #cbd5e1;
}

[data-theme="corporate"] .msj-bubble-other {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #000000 !important;
    font-weight: 500;
}

.msj-bubble-sender {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--solvix-cyan);
    margin-bottom: 2px;
    opacity: 0.8;
}

.msj-bubble-time {
    font-size: 0.65rem;
    color: #64748b;
    text-align: right;
    margin-top: 3px;
}

.msj-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #fff;
    padding: 8px 14px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

[data-theme="corporate"] .msj-input {
    color: #ffffff !important;
}

.msj-input:focus {
    border-color: rgba(0, 242, 255, 0.4);
    background: rgba(0, 242, 255, 0.05);
}

.msj-input::placeholder { color: #64748b; }

.msj-send-btn {
    background: rgba(0, 242, 255, 0.15);
    border: 1px solid rgba(0, 242, 255, 0.4);
    color: var(--solvix-cyan);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.msj-send-btn:hover {
    background: rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}


.color-blue {
    background: rgba(30, 58, 138, 0.25);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #93c5fd;
}
.color-blue:hover {
    background: rgba(30, 58, 138, 0.4);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.color-green {
    background: rgba(6, 78, 59, 0.25);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #6ee7b7;
}
.color-green:hover {
    background: rgba(6, 78, 59, 0.4);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.color-orange {
    background: rgba(154, 52, 18, 0.25);
    border: 1px solid rgba(249, 115, 22, 0.45);
    color: #fdba74;
}
.color-orange:hover {
    background: rgba(154, 52, 18, 0.4);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
}

.color-purple {
    background: rgba(88, 28, 135, 0.25);
    border: 1px solid rgba(147, 51, 234, 0.45);
    color: #c084fc;
}
.color-purple:hover {
    background: rgba(88, 28, 135, 0.4);
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.4);
}

.color-cyan {
    background: rgba(14, 74, 92, 0.25);
    border: 1px solid rgba(6, 182, 212, 0.45);
    color: #67e8f9;
}
.color-cyan:hover {
    background: rgba(14, 74, 92, 0.4);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.color-admin {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}
.color-admin:hover {
    background: rgba(220, 38, 38, 0.3);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Tasks List */
.home-task-item {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--solvix-silver);
    font-size: 0.95rem;
}

.home-task-item .fas {
    color: #fff;
    font-size: 1.2rem;
    opacity: 0.8;
}

.priority-high {
    background: rgba(225, 29, 72, 0.1);
    color: #fb7185;
    border-radius: 8px;
    border: 1px solid rgba(225, 29, 72, 0.2);
    margin-bottom: 8px;
}

.priority-high .fas {
    color: #f43f5e;
    opacity: 1 !important;
}

/* Interactive Tasks */
.task-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-clickable:hover {
    background-color: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
    border-left: 3px solid #fff;
}

/* Activity Feed */
.home-activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.activity-item:hover {
    border-color: rgba(0, 242, 255, 0.2);
}

.activity-icon {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: var(--solvix-silver);
    margin-bottom: 2px;
    line-height: 1.4;
}

.activity-time {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Activity Types */
.activity-type-reception .activity-icon {
    background: #dcfce7;
    color: #166534;
}

.activity-type-dispatch .activity-icon {
    background: #fee2e2;
    color: #991b1b;
}

.activity-type-storage .activity-icon {
    background: #e0e7ff;
    color: #3730a3;
}

.activity-type-system .activity-icon {
    background: #f1f5f9;
    color: #64748b;
}

/* HIDDEN HEADER LOGIC */
body.home-active header.header {
    display: none !important;
}

body.home-active section#dashboard {
    padding-top: 0 !important;
}

/* --- RESPONSIVE DESIGNS --- */
@media (max-width: 768px) {
    .home-hero-section {
        padding: 20px;
        text-align: center;
        border-radius: 0 0 20px 20px;
    }

    .home-welcome-text h1 {
        font-size: 1.8rem !important;
    }

    .ticker-text {
        font-size: 0.8rem;
    }

    .home-dashboard-grid {
        grid-template-columns: 1fr;
        /* Force single column on mobile */
        gap: 15px;
    }

    .quick-actions-grid {
        /* Keep 2 columns for buttons but smaller gap */
        gap: 10px;
    }

    .quick-btn {
        padding: 15px;
        font-size: 0.9rem;
    }

    .quick-btn .fas {
        font-size: 1.5rem;
    }
}

/* --- MONITORING PANEL 2x2 GRID --- */
.monitoring-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    /* Force equal height rows, prevents infinite expansion */
    gap: 20px;
    padding: 10px 0;
    height: calc(100vh - 140px);
    /* Fixed height to fill screen */
    min-height: 600px;
    /* Minimum reasonable height */
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .monitoring-grid-2x2 {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        /* Stack freely on mobile */
        height: auto;
        max-height: none;
    }
}

/* CARDS STYLING */
.monitoring-grid-2x2>.dashboard-section,
.monitoring-grid-2x2>.monitoring-analytics-section,
.monitoring-grid-2x2>.flow-module-container,
.monitoring-grid-2x2>div {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);

    /* Layout Logic for Internal Scroll */
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Fill the grid cell */
    overflow: hidden;
    /* Crucial: Contain children */
    min-height: 0;
    /* Crucial for Grid/Flex nesting */
}

/* Chart Container Fix */
.monitoring-grid-2x2 .chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
    width: 100%;
}

/* Table Container Fix - Enforce scroll */
.monitoring-grid-2x2 .table-container,
.monitoring-grid-2x2 .view-content,
.monitoring-grid-2x2 .list-container,
.monitoring-grid-2x2 .flow-table-wrapper {
    flex: 1;
    overflow-y: auto;
    /* Scroll internally */
    min-height: 0;
    /* Allow shrinking */
    margin-top: 10px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
}

/* Specific fix for the toggleable view container */
.monitoring-grid-2x2 #view-table {
    display: block;
    /* restore block for logic, but flex-parent handles size */
    height: 100%;
    overflow-y: auto;
}

/* --- CHART VISUAL WRAPPER (3D INSET) --- */
.chart-visual-wrapper {
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.15);
    /* Soft inner shadow */
    border-radius: 12px;
    background: #f8fafc;
    /* Slight off-white background to enhance depth */
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border definition */
}