/* ═══════════════════════════════════════════════════════════════
   MONITORING CENTER — App Health Dashboard Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Tab Navigation ── */
.mon-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary, #f0f2f5);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mon-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted, #888);
    white-space: nowrap;
    transition: all 0.2s ease;
    position: relative;
}

.mon-tab:hover {
    background: rgba(80, 120, 255, 0.06);
    color: var(--text-primary, #222);
}

.mon-tab.active {
    background: var(--bg-card, #fff);
    color: var(--primary, #5078ff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mon-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    margin-right: 4px;
    background: var(--danger, #ef4444);
    color: #fff;
}

/* ── Tab Content ── */
.mon-tab-content {
    display: none;
}

.mon-tab-content.active {
    display: block;
    animation: monFadeIn 0.2s ease;
}

@keyframes monFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Summary Cards Grid ── */
.mon-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.mon-card {
    background: var(--bg-card, #fff);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid var(--border, #e8ecf0);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mon-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.mon-card .card-icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.mon-card .card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary, #222);
    font-family: 'Tajawal', sans-serif;
}

.mon-card .card-label {
    font-size: 12px;
    color: var(--text-muted, #888);
    font-family: 'Tajawal', sans-serif;
    margin-top: 4px;
}

.mon-card .card-trend {
    font-size: 11px;
    margin-top: 6px;
    font-weight: 600;
}

.mon-card .card-trend.up {
    color: #ef4444;
}

.mon-card .card-trend.down {
    color: #22c55e;
}

.mon-card .card-trend.neutral {
    color: #888;
}

/* Card color accents */
.mon-card.danger {
    border-right: 4px solid #ef4444;
}

.mon-card.warning {
    border-right: 4px solid #f59e0b;
}

.mon-card.success {
    border-right: 4px solid #22c55e;
}

.mon-card.info {
    border-right: 4px solid #3b82f6;
}

/* ── Section Headers ── */
.mon-section {
    margin-bottom: 20px;
}

.mon-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.mon-section-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary, #222);
}

.mon-section-subtitle {
    font-size: 12px;
    color: var(--text-muted, #888);
    font-family: 'Tajawal', sans-serif;
}

/* ── Tables ── */
.mon-table-wrap {
    background: var(--bg-card, #fff);
    border-radius: 14px;
    border: 1px solid var(--border, #e8ecf0);
    overflow: hidden;
    margin-bottom: 20px;
}

.mon-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
}

.mon-table thead {
    background: var(--bg-secondary, #f8f9fb);
}

.mon-table th {
    padding: 12px 14px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted, #888);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border, #e8ecf0);
    white-space: nowrap;
}

.mon-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light, #f0f2f5);
    color: var(--text-primary, #222);
    vertical-align: middle;
}

.mon-table tbody tr {
    transition: background 0.15s ease;
    cursor: pointer;
}

.mon-table tbody tr:hover {
    background: rgba(80, 120, 255, 0.03);
}

.mon-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges ── */
.mon-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
}

.mon-badge.new {
    background: #dbeafe;
    color: #1d4ed8;
}

.mon-badge.investigating {
    background: #fef3c7;
    color: #92400e;
}

.mon-badge.acknowledged {
    background: #e0e7ff;
    color: #3730a3;
}

.mon-badge.fixed {
    background: #d1fae5;
    color: #065f46;
}

.mon-badge.ignored {
    background: #f3f4f6;
    color: #6b7280;
}

.mon-badge.open {
    background: #fee2e2;
    color: #991b1b;
}

.mon-badge.resolved {
    background: #d1fae5;
    color: #065f46;
}

.mon-badge.closed {
    background: #f3f4f6;
    color: #6b7280;
}

.mon-badge.in_review {
    background: #fef3c7;
    color: #92400e;
}

.mon-badge.linked {
    background: #e0e7ff;
    color: #3730a3;
}

/* Severity badges */
.mon-sev {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.mon-sev.critical {
    background: #fecaca;
    color: #991b1b;
}

.mon-sev.high {
    background: #fed7aa;
    color: #9a3412;
}

.mon-sev.medium {
    background: #fef3c7;
    color: #92400e;
}

.mon-sev.low {
    background: #d1fae5;
    color: #065f46;
}

/* Health badges */
.mon-health {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 8px;
}

.mon-health.healthy {
    background: #d1fae5;
    color: #065f46;
}

.mon-health.warning {
    background: #fef3c7;
    color: #92400e;
}

.mon-health.critical {
    background: #fecaca;
    color: #991b1b;
}

/* ── Filters Bar ── */
.mon-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid var(--border, #e8ecf0);
    align-items: center;
}

.mon-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mon-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #888);
    font-family: 'Tajawal', sans-serif;
    white-space: nowrap;
}

.mon-filter-select {
    padding: 6px 10px;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 12px;
    background: var(--bg-secondary, #f8f9fb);
    color: var(--text-primary, #222);
    cursor: pointer;
    min-width: 110px;
}

.mon-search-input {
    flex: 1;
    min-width: 180px;
    padding: 8px 14px;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    background: var(--bg-secondary, #f8f9fb);
    color: var(--text-primary, #222);
    direction: rtl;
}

.mon-search-input::placeholder {
    color: var(--text-muted, #aaa);
}

/* ── Detail Drawer ── */
.mon-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mon-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mon-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 560px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg-card, #fff);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.12);
    direction: rtl;
}

.mon-drawer.open {
    transform: translateX(0);
}

.mon-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #e8ecf0);
    position: sticky;
    top: 0;
    background: var(--bg-card, #fff);
    z-index: 10;
}

.mon-drawer-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 16px;
}

.mon-drawer-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted, #888);
    padding: 4px 8px;
    border-radius: 8px;
}

.mon-drawer-close:hover {
    background: var(--bg-secondary, #f0f2f5);
}

.mon-drawer-body {
    padding: 20px 24px;
}

.mon-drawer-section {
    margin-bottom: 20px;
}

.mon-drawer-section-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-muted, #888);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mon-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mon-detail-item {
    padding: 10px;
    background: var(--bg-secondary, #f8f9fb);
    border-radius: 10px;
}

.mon-detail-item .label {
    font-size: 10px;
    color: var(--text-muted, #888);
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.mon-detail-item .value {
    font-size: 13px;
    color: var(--text-primary, #222);
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    word-break: break-all;
}

.mon-detail-item.full {
    grid-column: 1 / -1;
}

/* ── Stack Trace ── */
.mon-stacktrace {
    background: #1e293b;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    direction: ltr;
    text-align: left;
    line-height: 1.6;
}

/* ── Screenshot Preview ── */
.mon-screenshot {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border, #e8ecf0);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mon-screenshot:hover {
    transform: scale(1.02);
}

/* ── Action Buttons ── */
.mon-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.mon-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mon-btn:hover {
    filter: brightness(0.95);
}

.mon-btn.primary {
    background: var(--primary, #5078ff);
    color: #fff;
}

.mon-btn.success {
    background: #22c55e;
    color: #fff;
}

.mon-btn.danger {
    background: #ef4444;
    color: #fff;
}

.mon-btn.warning {
    background: #f59e0b;
    color: #fff;
}

.mon-btn.ghost {
    background: transparent;
    border: 1px solid var(--border, #e8ecf0);
    color: var(--text-primary, #222);
}

.mon-btn.ghost:hover {
    background: var(--bg-secondary, #f0f2f5);
}

/* ── Alerts Panel ── */
.mon-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mon-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid var(--border, #e8ecf0);
    transition: background 0.15s ease;
}

.mon-alert-item:hover {
    background: var(--bg-secondary, #f8f9fb);
}

.mon-alert-item.unread {
    border-right: 4px solid #3b82f6;
    background: rgba(59, 130, 246, 0.03);
}

.mon-alert-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.mon-alert-content {
    flex: 1;
}

.mon-alert-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary, #222);
    margin-bottom: 4px;
}

.mon-alert-desc {
    font-family: 'Tajawal', sans-serif;
    font-size: 12px;
    color: var(--text-muted, #888);
    margin-bottom: 6px;
}

.mon-alert-time {
    font-size: 10px;
    color: var(--text-muted, #aaa);
    font-family: 'Tajawal', sans-serif;
}

/* ── Empty State ── */
.mon-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted, #888);
}

.mon-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.mon-empty-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
}

.mon-empty-desc {
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
}

/* ── Loading Skeleton ── */
.mon-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: monShimmer 1.5s infinite;
    border-radius: 8px;
    height: 16px;
    margin-bottom: 8px;
}

@keyframes monShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ── Notes Textarea ── */
.mon-notes-area {
    width: 100%;
    min-height: 80px;
    padding: 10px 14px;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    resize: vertical;
    direction: rtl;
    background: var(--bg-secondary, #f8f9fb);
}

/* ── Pagination ── */
.mon-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
}

.mon-page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    font-family: 'Tajawal', sans-serif;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-primary, #222);
}

.mon-page-btn.active {
    background: var(--primary, #5078ff);
    color: #fff;
    border-color: var(--primary, #5078ff);
}

.mon-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .mon-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .mon-detail-grid {
        grid-template-columns: 1fr;
    }

    .mon-drawer {
        width: 100%;
        max-width: 100%;
    }

    .mon-filters {
        flex-direction: column;
    }

    .mon-tabs {
        gap: 2px;
    }

    .mon-tab {
        padding: 8px 12px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .mon-cards {
        grid-template-columns: 1fr;
    }
}

/* ── Quick Links ── */
.mon-quick-links {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mon-quick-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #5078ff);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mon-quick-link:hover {
    background: rgba(80, 120, 255, 0.06);
    transform: translateY(-1px);
}

/* ── Linked Items ── */
.mon-linked-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary, #f8f9fb);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-family: 'Tajawal', sans-serif;
    font-size: 12px;
}

.mon-linked-item:hover {
    background: rgba(80, 120, 255, 0.06);
}