/* Simulator styles - Account Changes Simulator */

/* Split panel layout */
.sim-container {
    display: flex;
    min-height: calc(100vh - 120px);
}
.sim-left {
    width: 35%;
    min-width: 280px;
    max-width: 420px;
    background: #fff;
    border-right: 2px solid #e2e8f0;
    padding: 16px;
    overflow-y: auto;
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 120px);
}
.sim-right {
    flex: 1;
    padding: 16px;
    overflow-x: auto;
}

/* Summary sections */
.sim-section {
    margin-bottom: 16px;
}
.sim-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #718096;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #edf2f7;
}

/* Summary cards */
.sim-card {
    background: #f7fafc;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-left: 4px solid #3182ce;
}
.sim-card.card-current { border-left-color: #3182ce; }
.sim-card.card-proposed { border-left-color: #38a169; background: #f0fff4; }
.sim-card.card-delta { border-left-color: #d69e2e; background: #fffff0; }
.sim-card.card-penalty { border-left-color: #e53e3e; background: #fff5f5; }

.sim-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #718096;
    margin-bottom: 2px;
}
.sim-card-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #1a365d;
}
.sim-card-sub {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 2px;
}

/* Delta values */
.sim-card-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}
.sim-card-row:last-child { margin-bottom: 0; }
.sim-card-row .label {
    font-size: 12px;
    color: #4a5568;
}
.sim-card-row .value {
    font-size: 14px;
    font-weight: 700;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
.delta-positive { color: #38a169; }
.delta-negative { color: #e53e3e; }
.delta-neutral { color: #d69e2e; }

/* Quick action buttons */
.sim-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.sim-action-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.sim-action-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}
.sim-action-btn .count {
    background: #cbd5e0;
    color: #4a5568;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.sim-action-btn.btn-danger {
    color: #9b2c2c;
    border-color: #feb2b2;
    background: #fff5f5;
}
.sim-action-btn.btn-danger:hover {
    background: #fed7d7;
}
.sim-action-btn.btn-reset {
    color: #718096;
    border-color: #cbd5e0;
    background: #f7fafc;
}
.sim-action-btn.btn-reset:hover {
    background: #edf2f7;
}

/* Toggle switch, toggle-cell, sim-deactivated base styles are in dashboard.css */

/* Dormancy row colors */
tr.dormancy-truly-dormant { background-color: #fff5f5 !important; }
tr.dormancy-truly-dormant td { color: #9b2c2c; }
tr.dormancy-likely-dormant { background-color: #fffaf0 !important; }
tr.dormancy-likely-dormant td { color: #7b341e; }
tr.dormancy-active { background-color: #f0fff4 !important; }
tr.dormancy-active td { color: #22543d; }
tr.dormancy-device { background-color: #ebf8ff !important; }
tr.dormancy-device td { color: #2b6cb0; }

/* Risk column */
.risk-warning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #e53e3e;
    font-weight: 600;
    font-size: 12px;
}
.risk-icon {
    font-size: 14px;
}
.risk-safe {
    color: #38a169;
    font-size: 12px;
}

/* No-change state */
.sim-no-changes {
    text-align: center;
    padding: 20px;
    color: #a0aec0;
    font-size: 13px;
}

/* Penalty list */
.penalty-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}
.penalty-list li {
    font-size: 12px;
    color: #9b2c2c;
    padding: 2px 0;
    display: flex;
    justify-content: space-between;
}
.penalty-list li .mobile {
    color: #4a5568;
}

/* Responsive stacking */
@media (max-width: 1024px) {
    .sim-container {
        flex-direction: column;
    }
    .sim-left {
        width: 100%;
        max-width: none;
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
        position: static;
        max-height: none;
        padding: 12px;
    }
    .sim-right {
        padding: 12px;
    }
    /* Collapse cards into a grid on tablet */
    .sim-cards-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .sim-cards-grid {
        grid-template-columns: 1fr;
    }
    .sim-left {
        padding: 10px;
    }
    .sim-right {
        padding: 8px;
    }
    .sim-card-value {
        font-size: 1.1em;
    }
}

/* DataTable override for simulator */
.sim-right .dataTables_wrapper {
    background: #fff;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.sim-right table.dataTable tbody tr {
    cursor: pointer;
    transition: background 0.15s, opacity 0.2s;
}
.sim-right table.dataTable tbody tr:hover {
    background: #ebf4ff !important;
}

/* Legend / filter toggles */
.sim-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px;
    background: #f7fafc;
    border-radius: 4px;
    border: 1px solid #edf2f7;
    align-items: center;
}
.sim-legend-label {
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 2px;
}
.sim-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #4a5568;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.sim-legend-item:hover {
    border-color: #3182ce;
    background: #ebf8ff;
}
.sim-legend-item.active {
    color: #fff;
    background: #3182ce;
    border-color: #2b6cb0;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(49,130,206,0.3);
}
.sim-legend-item.active .sim-legend-swatch {
    border-color: rgba(255,255,255,0.5);
}
.sim-legend-clear {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: #718096;
    background: none;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
    margin-left: auto;
    transition: background 0.15s, color 0.15s;
}
.sim-legend-clear:hover {
    background: #edf2f7;
    color: #2d3748;
}
.sim-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
}
.swatch-truly-dormant { background: #fff5f5; }
.swatch-likely-dormant { background: #fffaf0; }
.swatch-active { background: #f0fff4; }
.swatch-device { background: #ebf8ff; }

/* Confirmation overlay */
.sim-confirm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.sim-confirm-overlay.active { display: flex; }
.sim-confirm-box {
    background: #fff;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    text-align: center;
}
.sim-confirm-box h3 {
    font-size: 16px;
    color: #1a365d;
    margin-bottom: 8px;
}
.sim-confirm-box p {
    font-size: 13px;
    color: #718096;
    margin-bottom: 16px;
}
.sim-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.sim-confirm-btn {
    padding: 8px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.sim-confirm-btn.primary {
    background: #3182ce;
    color: #fff;
    border-color: #3182ce;
}
.sim-confirm-btn.primary:hover { background: #2c5282; }
.sim-confirm-btn.cancel {
    background: #f7fafc;
    color: #4a5568;
}
.sim-confirm-btn.cancel:hover { background: #edf2f7; }

/* Plan breakdown tally table */
.plan-tally-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.plan-tally-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #718096;
    font-weight: 600;
    padding: 4px 6px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}
.plan-tally-table th:nth-child(2),
.plan-tally-table th:nth-child(3) {
    text-align: center;
    width: 50px;
}
.plan-tally-table td {
    padding: 3px 6px;
    border-bottom: 1px solid #f7fafc;
    color: #4a5568;
}
.plan-tally-table td.plan-count {
    text-align: center;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
.plan-tally-table tfoot td {
    border-top: 2px solid #e2e8f0;
    border-bottom: none;
    padding-top: 4px;
}
.plan-tally-table tr.plan-changed td {
    background: #fffff0;
}
.plan-delta {
    color: #e53e3e;
    font-size: 10px;
    font-weight: 400;
}

/* Actioned tri-state element */
.actioned-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    line-height: 1;
}
.actioned-off {
    color: #a0aec0;
    background: #edf2f7;
}
.actioned-off:hover {
    background: #e2e8f0;
}
.actioned-pending {
    color: #d97706;
    background: #fef3c7;
}
.actioned-pending:hover {
    background: #fde68a;
}
.actioned-done {
    color: #059669;
    background: #d1fae5;
}
.actioned-done:hover {
    background: #a7f3d0;
}

/* Actioned cell styling */
.actioned-cell {
    text-align: center !important;
    padding: 4px 6px !important;
}

/* Pending row: orange hatched background */
tr.sim-pending {
    background: repeating-linear-gradient(
        -45deg,
        #fffbeb,
        #fffbeb 6px,
        #fde68a 6px,
        #fde68a 7px
    ) !important;
}
tr.sim-pending td {
    color: #92400e !important;
}
tr.sim-pending td.toggle-cell {
    text-decoration: none;
}

/* Actioned row: green hatched background to show it's been done */
tr.sim-actioned {
    background: repeating-linear-gradient(
        -45deg,
        #f0fff4,
        #f0fff4 6px,
        #c6f6d5 6px,
        #c6f6d5 7px
    ) !important;
}
tr.sim-actioned td {
    color: #276749 !important;
}
tr.sim-actioned td.toggle-cell {
    text-decoration: none;
}

/* Export info text */
.sim-export-info {
    margin-top: 12px;
    padding: 8px 12px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 4px;
    font-size: 11px;
    color: #2b6cb0;
    text-align: center;
}

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] .sim-left {
    background: #1e293b;
    border-right-color: #334155;
}

[data-theme="dark"] .sim-right {
    background: #0f172a;
}

[data-theme="dark"] .sim-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .sim-card h3 {
    color: #e2e8f0;
}

[data-theme="dark"] .sim-card.card-proposed {
    background: rgba(74, 222, 128, 0.05);
    border-left-color: #4ade80;
}

[data-theme="dark"] .sim-card.card-penalty {
    background: rgba(248, 113, 113, 0.05);
    border-left-color: #f87171;
}

[data-theme="dark"] .sim-card.card-warning {
    background: rgba(251, 191, 36, 0.05);
    border-left-color: #fbbf24;
}

[data-theme="dark"] .sim-table th {
    background: #0f172a;
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] .sim-table td {
    color: #e2e8f0;
    border-color: #334155;
}

[data-theme="dark"] .sim-table tr:hover td {
    background: rgba(51, 65, 85, 0.3);
}

[data-theme="dark"] .sim-label {
    color: #94a3b8;
}

[data-theme="dark"] .sim-value {
    color: #e2e8f0;
}

[data-theme="dark"] .sim-toggle {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .sim-btn {
    background: #334155;
    color: #e2e8f0;
    border-color: #475569;
}

[data-theme="dark"] .sim-btn:hover {
    background: #475569;
}

[data-theme="dark"] .sim-btn.primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

[data-theme="dark"] .penalty-list li {
    color: #f87171;
}

[data-theme="dark"] tr.dormancy-high td {
    background: rgba(248, 113, 113, 0.08);
}

[data-theme="dark"] tr.dormancy-medium td {
    background: rgba(251, 191, 36, 0.08);
}

[data-theme="dark"] tr.dormancy-low td {
    background: rgba(251, 146, 60, 0.08);
}

/* Dark mode: Actioned tri-state */
[data-theme="dark"] .actioned-off {
    color: #64748b;
    background: #334155;
}
[data-theme="dark"] .actioned-off:hover {
    background: #475569;
}
[data-theme="dark"] .actioned-pending {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
}
[data-theme="dark"] .actioned-pending:hover {
    background: rgba(251, 191, 36, 0.25);
}
[data-theme="dark"] .actioned-done {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
}
[data-theme="dark"] .actioned-done:hover {
    background: rgba(74, 222, 128, 0.25);
}

/* Dark mode: Pending row */
[data-theme="dark"] tr.sim-pending {
    background: repeating-linear-gradient(
        -45deg,
        rgba(251, 191, 36, 0.05),
        rgba(251, 191, 36, 0.05) 6px,
        rgba(251, 191, 36, 0.15) 6px,
        rgba(251, 191, 36, 0.15) 7px
    ) !important;
}
[data-theme="dark"] tr.sim-pending td {
    color: #fbbf24 !important;
}

/* Dark mode: Actioned row */
[data-theme="dark"] tr.sim-actioned {
    background: repeating-linear-gradient(
        -45deg,
        rgba(74, 222, 128, 0.05),
        rgba(74, 222, 128, 0.05) 6px,
        rgba(74, 222, 128, 0.15) 6px,
        rgba(74, 222, 128, 0.15) 7px
    ) !important;
}
[data-theme="dark"] tr.sim-actioned td {
    color: #4ade80 !important;
}
