/* ============================================================
   EHS Safety Incidents — Styles
   ============================================================ */

/* Container */
.incidents-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* Header row */
.incidents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.incidents-header h2 {
    font-size: 22px;
    color: #1d1d1f;
    margin: 0;
    font-weight: 700;
}

.incidents-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Stats row */
.incidents-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .incidents-stats { grid-template-columns: repeat(2, 1fr); }
}

.incidents-stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
}

.incidents-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1;
    margin-bottom: 4px;
}

.incidents-stat-label {
    font-size: 11px;
    color: #6e6e73;
    font-weight: 500;
}

/* Filters row */
.incidents-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.incidents-filter-select {
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    color: #374151;
}

.incidents-filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

/* List */
.incidents-list {
    display: grid;
    gap: 12px;
}

/* Incident card */
.incident-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 20px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-left: 4px solid #e5e7eb;
}

.incident-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #667eea;
}

/* Left border severity colors */
.incident-card.severity-fatality      { border-left-color: #e53e3e; }
.incident-card.severity-serious       { border-left-color: #ed8936; }
.incident-card.severity-moderate      { border-left-color: #3182ce; }
.incident-card.severity-minor         { border-left-color: #38a169; }
.incident-card.severity-near_miss     { border-left-color: #805ad5; }

.incident-card-icon {
    font-size: 28px;
    flex-shrink: 0;
    margin-top: 2px;
}

.incident-card-info {
    flex: 1;
    min-width: 0;
}

.incident-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incident-card-meta {
    font-size: 12px;
    color: #6e6e73;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.incident-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Badges */
.incident-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Severity badges */
.badge-severity-fatality   { background: #fff5f5; color: #e53e3e; border: 1px solid #fed7d7; }
.badge-severity-serious    { background: #fffaf0; color: #c05621; border: 1px solid #fbd38d; }
.badge-severity-moderate   { background: #ebf8ff; color: #2c5282; border: 1px solid #bee3f8; }
.badge-severity-minor      { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.badge-severity-near_miss  { background: #faf5ff; color: #553c9a; border: 1px solid #d6bcfa; }

/* Status badges */
.badge-status-open             { background: #fff5f5; color: #c53030; }
.badge-status-investigating    { background: #fffaf0; color: #c05621; }
.badge-status-corrective_action { background: #ebf8ff; color: #2c5282; }
.badge-status-closed           { background: #f0fff4; color: #276749; }

/* Buttons */
.incidents-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.incidents-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}
.incidents-btn-primary:hover { opacity: 0.88; }

.incidents-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}
.incidents-btn-secondary:hover { background: #e5e7eb; }

.incidents-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}
.incidents-btn-danger:hover { background: #fca5a5; }

.incidents-btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Empty state */
.incidents-empty {
    text-align: center;
    padding: 60px 20px;
}

.incidents-empty-icon {
    font-size: 52px;
    margin-bottom: 14px;
}

.incidents-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.incidents-empty-desc {
    font-size: 13px;
    color: #64748b;
    max-width: 400px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

/* Detail view */
.incidents-detail {
    background: white;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.incidents-detail-head {
    background: linear-gradient(135deg, #553c9a 0%, #667eea 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.incidents-detail-type {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 4px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.incidents-detail-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.incidents-detail-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    opacity: 0.85;
}

.incidents-detail-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Detail body */
.incidents-detail-body {
    padding: 20px 24px;
    display: grid;
    gap: 16px;
}

.incidents-section {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.incidents-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.incidents-section-content {
    padding: 14px;
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
}

.incidents-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .incidents-info-grid { grid-template-columns: 1fr; }
}

.incidents-info-item {}

.incidents-info-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6e6e73;
    margin-bottom: 3px;
}

.incidents-info-value {
    font-size: 13px;
    color: #1d1d1f;
    font-weight: 500;
}

/* Detail footer */
.incidents-detail-footer {
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.incidents-footer-meta {
    font-size: 12px;
    color: #9ca3af;
}

/* Status select */
.incidents-status-select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 13px;
    font-family: inherit;
    background: white;
    cursor: pointer;
}

.incidents-status-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Form elements */
.incidents-form-group {
    margin-bottom: 14px;
}

.incidents-form-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.incidents-form-input,
.incidents-form-textarea,
.incidents-form-select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: #1d1d1f;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: white;
}

.incidents-form-input:focus,
.incidents-form-textarea:focus,
.incidents-form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.incidents-form-textarea { resize: vertical; min-height: 80px; }

.incidents-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .incidents-form-row { grid-template-columns: 1fr; }
}

/* Modal */
.incidents-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.incidents-modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.incidents-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 18px;
}

.incidents-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Toast */
.incidents-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1d1d1f;
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    animation: incidents-toast-in 0.25s ease;
}

@keyframes incidents-toast-in {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Responsive */
@media (max-width: 640px) {
    .incidents-detail-head { padding: 16px; }
    .incidents-detail-title { font-size: 16px; }
    .incidents-detail-body { padding: 14px; }
    .incidents-detail-footer { padding: 12px 14px; }
}
