/* ============================================
   TECH Diagnostics Widget — Client Environment Check
   Design: CODEX VALI (Mercedes-style, subtle)
   ============================================ */

/* ==================== VARIABLES ==================== */
.tech-diag-widget {
    --diag-navy: var(--help-navy, #003168);
    --diag-success: var(--help-success, #10b981);
    --diag-error: var(--help-error, #ef4444);
    --diag-warning: var(--help-warning, #f59e0b);
    --diag-bg: #ffffff;
    --diag-text: #1f2937;
    --diag-text-muted: #6b7280;
    --diag-border: #e5e7eb;
    --diag-radius: 12px;
    --diag-shadow: 0 8px 32px rgba(0, 49, 104, 0.12);
    --diag-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --diag-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ==================== STATUS INDICATOR ==================== */
.tech-diag-indicator {
    position: fixed;
    bottom: 18px;
    left: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 9998;
    cursor: pointer;
    transition: all var(--diag-transition);
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.tech-diag-indicator:hover {
    transform: scale(1.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.tech-diag-indicator--ok { background: var(--diag-success); }
.tech-diag-indicator--warning { background: var(--diag-warning); animation: diag-pulse 2s infinite; }
.tech-diag-indicator--critical { background: var(--diag-error); animation: diag-pulse 1.2s infinite; }

@keyframes diag-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== PANEL ==================== */
.tech-diag-panel {
    position: fixed;
    bottom: 40px;
    left: 18px;
    width: 340px;
    max-height: 70vh;
    background: var(--diag-bg);
    border-radius: var(--diag-radius);
    box-shadow: var(--diag-shadow);
    z-index: 9999;
    font-family: var(--diag-font);
    font-size: 13px;
    color: var(--diag-text);
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    pointer-events: none;
    transition: all var(--diag-transition);
}
.tech-diag-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Panel header */
.tech-diag-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--diag-border);
}
.tech-diag-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--diag-navy);
}
.tech-diag-close {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--diag-text-muted);
    font-size: 18px;
    line-height: 1;
    border-radius: 6px;
    transition: background var(--diag-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tech-diag-close:hover { background: #f3f4f6; }

/* Panel body */
.tech-diag-body {
    padding: 12px 16px;
    overflow-y: auto;
    max-height: calc(70vh - 52px);
}

/* Section */
.tech-diag-section {
    margin-bottom: 14px;
}
.tech-diag-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--diag-text-muted);
    margin: 0 0 8px;
}

/* Environment table */
.tech-diag-env {
    width: 100%;
    border-collapse: collapse;
}
.tech-diag-env td {
    padding: 3px 0;
    vertical-align: top;
}
.tech-diag-env td:first-child {
    width: 110px;
    color: var(--diag-text-muted);
    font-size: 12px;
}
.tech-diag-env td:last-child {
    font-size: 12px;
    font-weight: 500;
    word-break: break-word;
}

/* Issue badges */
.tech-diag-issue {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
}
.tech-diag-issue--critical { background: #fef2f2; color: #991b1b; }
.tech-diag-issue--warning  { background: #fffbeb; color: #92400e; }
.tech-diag-issue--info     { background: #eff6ff; color: #1e40af; }

.tech-diag-issue-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

/* No issues */
.tech-diag-ok {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #ecfdf5;
    border-radius: 8px;
    color: #065f46;
    font-size: 12px;
    font-weight: 500;
}

/* Export button */
.tech-diag-export {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    border: 1px solid var(--diag-border);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    font-family: var(--diag-font);
    font-size: 12px;
    color: var(--diag-text-muted);
    transition: all var(--diag-transition);
    text-align: center;
}
.tech-diag-export:hover {
    background: #f9fafb;
    color: var(--diag-navy);
    border-color: var(--diag-navy);
}

/* ==================== CRITICAL BANNER ==================== */
.tech-diag-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-family: var(--diag-font);
    font-size: 13px;
    animation: diag-slide-down 0.3s ease-out;
}
.tech-diag-banner--critical {
    background: var(--diag-error);
    color: #ffffff;
}
.tech-diag-banner--warning {
    background: var(--diag-warning);
    color: #78350f;
}
.tech-diag-banner svg { flex-shrink: 0; }
.tech-diag-banner span { flex: 1; }
.tech-diag-banner-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tech-diag-banner-close:hover { background: rgba(255, 255, 255, 0.35); }

@keyframes diag-slide-down {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .tech-diag-indicator {
        bottom: 72px; /* above mobile nav bars */
    }
    .tech-diag-panel {
        left: 8px;
        right: 8px;
        width: auto;
        bottom: 88px;
    }
}
