/* LEDGER RULES TABLE STYLES */

/* Statistics Bar */
.rules-stats-bar-new {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-info .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-info .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

/* Filters Bar */
.rules-filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-group:last-child {
    position: relative;
    max-width: 300px;
}

.filter-group:last-child input {
    padding-right: 2.5rem;
}

.filter-group:last-child i {
    position: absolute;
    right: 1rem;
    bottom: 2.5rem;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Rules Table */
.rules-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.rules-table thead {
    background: var(--bg);
    border-bottom: 2px solid var(--border-color);
}

.rules-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rules-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text);
}

.rules-table tbody tr {
    transition: background 0.2s;
}

.rules-table tbody tr:hover {
    background: var(--bg);
}

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

/* Table Cells */
.rule-name-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rule-name-cell strong {
    color: var(--text);
    font-size: 0.95rem;
}

.rule-name-cell small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.loading-cell,
.empty-cell,
.error-cell {
    text-align: center;
    padding: 3rem !important;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.empty-state-table {
    text-align: center;
    padding: 2rem;
}

.empty-state-table i {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-table h3 {
    margin: 0.5rem 0;
    color: var(--text);
}

.empty-state-table p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.error-cell {
    color: #e74c3c;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-detection {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.badge-validation {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-alert {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-notification {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-critical {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-high {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.badge-medium {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-low {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

.badge-severity-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    font-weight: 700;
}

.badge-severity-high {
    background: rgba(249, 115, 22, 0.15);
    color: #ea580c;
    font-weight: 700;
}

.badge-severity-medium {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
    font-weight: 700;
}

.badge-severity-low {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
    font-weight: 700;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-enabled {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-disabled {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-edit {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.btn-edit:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-toggle {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.btn-toggle:hover {
    background: #10b981;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Hash Mismatch Alert Card */
#hash-mismatch-alert-card {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.05) 0%, rgba(192, 57, 43, 0.05) 100%);
}

.mismatch-info {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.mismatch-stat {
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    min-width: 200px;
}

.mismatch-value {
    font-size: 3rem;
    font-weight: 700;
    color: #e74c3c;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.mismatch-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.mismatch-details {
    flex: 1;
}

.mismatch-details p {
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.mismatch-actions {
    display: flex;
    gap: 1rem;
}

.mismatch-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.mismatch-details-table th,
.mismatch-details-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.mismatch-details-table th {
    background: var(--bg);
    font-weight: 600;
}

.mismatch-details-table code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: var(--bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.badge-detection-type {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .rules-table {
        font-size: 0.9rem;
    }
    
    .rules-table th,
    .rules-table td {
        padding: 0.75rem;
    }
    
    .mismatch-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mismatch-stat {
        min-width: auto;
    }
}

@media (max-width: 992px) {
    .rules-stats-bar-new {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rules-filters-bar {
        flex-wrap: wrap;
    }
    
    .filter-group {
        flex: 1 1 calc(50% - 10px);
        min-width: 200px;
    }
    
    .rules-table {
        font-size: 0.85rem;
    }
    
    .rules-table th,
    .rules-table td {
        padding: 0.6rem;
    }
}

@media (max-width: 768px) {
    .rules-stats-bar-new {
        grid-template-columns: 1fr;
    }
    
    .rules-filters-bar {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .rules-table {
        display: block;
        overflow-x: auto;
    }
    
    .table-actions {
        flex-direction: column;
    }
    
    .mismatch-actions {
        flex-direction: column;
    }
}
