/* EHS Safety Rating System - Custom Styles */

/* Color scheme matching scoring status */
:root {
    --status-red: #dc3545;
    --status-orange: #fd7e14;
    --status-yellow: #ffc107;
    --status-green: #28a745;
    --primary-blue: #0d6efd;
}

/* Status badges */
.badge-red {
    background-color: var(--status-red);
    color: white;
}

.badge-orange {
    background-color: var(--status-orange);
    color: white;
}

.badge-yellow {
    background-color: var(--status-yellow);
    color: black;
}

.badge-green {
    background-color: var(--status-green);
    color: white;
}

/* Tier badges */
.tier-badge {
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.tier-1 { background-color: #721c24; color: white; }
.tier-2 { background-color: #856404; color: white; }
.tier-3 { background-color: #0c5460; color: white; }
.tier-4 { background-color: #004085; color: white; }
.tier-5 { background-color: #155724; color: white; }
.tier-6 { background-color: #383d41; color: white; }

/* Event cards */
.event-card {
    transition: box-shadow 0.2s ease-in-out;
    margin-bottom: 1rem;
}

.event-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Score display */
.score-display {
    font-size: 2rem;
    font-weight: bold;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.score-breakdown {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Dashboard cards */
.dashboard-card {
    border-left: 4px solid var(--primary-blue);
    transition: transform 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-card.red { border-left-color: var(--status-red); }
.dashboard-card.orange { border-left-color: var(--status-orange); }
.dashboard-card.yellow { border-left-color: var(--status-yellow); }
.dashboard-card.green { border-left-color: var(--status-green); }

/* Dashboard section headers */
.dashboard-section-header {
    background-color: #2c3e50 !important;
    color: #fff !important;
    border-bottom: none;
}

.dashboard-section-header h5,
.dashboard-section-header i {
    color: #fff !important;
}

.dashboard-section-header .badge {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

/* Form styling */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-help-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Event submission form */
.modifier-section {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.modifier-section h5 {
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

/* Score preview in form */
.score-preview {
    position: sticky;
    top: 20px;
    background-color: white;
    border: 2px solid var(--primary-blue);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.score-preview-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-blue);
}

/* Table styling */
.table-hover tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* Notification badge */
#notificationCount {
    position: relative;
    top: -2px;
    font-size: 0.7rem;
}

/* Status indicators */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-indicator.red { background-color: var(--status-red); }
.status-indicator.orange { background-color: var(--status-orange); }
.status-indicator.yellow { background-color: var(--status-yellow); }
.status-indicator.green { background-color: var(--status-green); }

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .score-display {
        font-size: 1.5rem;
    }

    .score-preview {
        position: relative;
        margin-bottom: 1rem;
    }

    .dashboard-card {
        margin-bottom: 1rem;
    }
}

/* Report-specific styles */
.report-card {
    border-left: 4px solid var(--primary-blue);
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.trend-improving { color: var(--status-green); font-weight: 600; }
.trend-declining { color: var(--status-red); font-weight: 600; }
.trend-stable { color: #6c757d; }

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

.chart-container-sm {
    position: relative;
    height: 300px;
    width: 100%;
}

.needs-capa-row {
    background-color: rgba(220, 53, 69, 0.05) !important;
}

.score-display-sm {
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

/* EHS Manager dashboard work-queue tables */
.card-body.p-0 .table {
    font-size: 0.9rem;
}
.card-body.p-0 .table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

/* Print styles */
@media print {
    nav, footer {
        display: none;
    }

    .no-print {
        display: none;
    }
}

/* ── File Attachments ─────────────────────────────────────────────── */

.drop-zone-active {
    border-color: #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.05) !important;
}

.attachment-card {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.15s, opacity 0.3s;
}

.attachment-card:hover {
    background-color: #f8f9fa;
}

.attachment-card .file-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    min-width: 2rem;
    text-align: center;
}

.attachment-card .file-info {
    flex: 1;
    min-width: 0;
}

.attachment-card .file-info .file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-card .file-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.75rem;
    flex-shrink: 0;
}

.attachment-fade-out {
    opacity: 0;
}


/* ── Discussion Thread ──────────────────────────────────────────────────── */

.comment-item {
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.comment-item .comment-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.125rem;
    margin-bottom: 0.375rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.comment-item .comment-header strong {
    color: #212529;
    font-size: 0.85rem;
}

.comment-item .comment-sep {
    margin: 0 0.2rem;
    color: #ced4da;
}

.comment-item .comment-role {
    color: #6c757d;
}

.comment-item .comment-time {
    color: #adb5bd;
}

.comment-item .comment-action-link {
    font-size: 0.8rem;
    text-decoration: none;
    color: #6c757d;
}

.comment-item .comment-action-link:hover {
    color: #0d6efd;
}

.comment-item .comment-action-link.text-danger:hover {
    color: #dc3545;
}

.comment-item .comment-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #343a40;
    white-space: pre-wrap;
}

.comment-item .comment-body .mention {
    color: #0d6efd;
    font-weight: 600;
    background-color: rgba(13, 110, 253, 0.08);
    padding: 0.05rem 0.25rem;
    border-radius: 0.2rem;
}

.comment-replies {
    margin-top: 0.5rem;
    margin-left: 1.25rem;
    border-left: 2px solid #e9ecef;
    padding-left: 0.75rem;
}

.comment-replies .comment-item {
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
}

.mention-dropdown {
    position: absolute;
    z-index: 1050;
    max-height: 200px;
    overflow-y: auto;
    min-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    background: #fff;
    border: 1px solid #dee2e6;
}

.mention-dropdown .mention-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
}

.mention-dropdown .mention-item:hover,
.mention-dropdown .mention-item.active {
    background-color: #0d6efd;
    color: white;
}

.mention-dropdown .mention-item:hover small,
.mention-dropdown .mention-item.active small {
    color: rgba(255, 255, 255, 0.8) !important;
}

.reply-form textarea {
    font-size: 0.85rem;
}

.comment-deleted .comment-body {
    color: #adb5bd;
    font-style: italic;
}

.comment-deleted .comment-header strong {
    color: #adb5bd;
}

@keyframes commentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.comment-item-new {
    animation: commentFadeIn 0.3s ease-out;
}
