/* Security Dashboard Styles */

.security-dashboard {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.dashboard-header h2 {
    color: #333;
    margin: 0;
    font-size: 1.8rem;
}

.refresh-controls {
    display: flex;
    gap: 10px;
}

.refresh-controls .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.refresh-controls .btn-primary {
    background: #007bff;
    color: white;
}

.refresh-controls .btn-success {
    background: #28a745;
    color: white;
}

.refresh-controls .btn-secondary {
    background: #6c757d;
    color: white;
}

.refresh-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Security Alerts */
.security-alerts {
    margin-bottom: 30px;
}

.security-alerts h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-item.critical {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.alert-item.high {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
}

.alert-details {
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-details strong {
    display: inline-block;
    min-width: 60px;
}

/* Stats Grid */
.security-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-top: 4px solid;
}

.stat-card.total-events {
    border-top-color: #007bff;
}

.stat-card.high-severity {
    border-top-color: #dc3545;
}

.stat-card.unique-users {
    border-top-color: #ffc107;
}

.stat-card.event-types {
    border-top-color: #17a2b8;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stat-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.stat-header span {
    font-size: 0.8rem;
    color: #666;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
}

.stat-value.danger {
    color: #dc3545;
}

.stat-value.warning {
    color: #ffc107;
}

.event-breakdown {
    max-height: 150px;
    overflow-y: auto;
}

.event-type-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.event-type-item:last-child {
    border-bottom: none;
}

.type-name {
    font-size: 0.9rem;
    color: #555;
}

.type-count {
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Recent Events */
.recent-events {
    margin-bottom: 30px;
}

.recent-events h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.event-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    border-left: 4px solid;
}

.event-item.severity-high {
    border-left-color: #ffc107;
}

.event-item.severity-critical {
    border-left-color: #dc3545;
}

.event-item.severity-medium {
    border-left-color: #17a2b8;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.event-type {
    font-weight: bold;
    color: #333;
}

.event-severity {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.event-severity.high {
    background: #fff3cd;
    color: #856404;
}

.event-severity.critical {
    background: #f8d7da;
    color: #721c24;
}

.event-severity.medium {
    background: #d1ecf1;
    color: #0c5460;
}

.event-time {
    font-size: 0.8rem;
    color: #666;
}

.event-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
    color: #555;
}

.event-user, .event-page, .event-ip {
    padding: 5px 0;
}

.event-extra-details {
    grid-column: 1 / -1;
    margin-top: 10px;
}

.event-extra-details details {
    cursor: pointer;
}

.event-extra-details summary {
    font-weight: bold;
    color: #007bff;
    padding: 5px 0;
}

.event-extra-details pre {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin-top: 5px;
}

/* Top Violators */
.top-violators {
    margin-bottom: 30px;
}

.top-violators h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.violators-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.violator-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.violator-rank {
    font-size: 1.5rem;
    font-weight: bold;
    color: #666;
    min-width: 40px;
    text-align: center;
}

.violator-item.rank-1 .violator-rank {
    color: #dc3545;
}

.violator-item.rank-2 .violator-rank {
    color: #ffc107;
}

.violator-item.rank-3 .violator-rank {
    color: #fd7e14;
}

.violator-info {
    flex: 1;
}

.violator-email {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.violation-count {
    font-size: 0.9rem;
    color: #666;
}

.violator-actions .btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.violator-actions .btn-primary {
    background: #007bff;
    color: white;
}

.violator-actions .btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Security Modal */
.security-modal .modal-content {
    max-width: 600px;
    margin: 5% auto;
}

.security-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.security-modal .modal-header h3 {
    margin: 0;
    color: #333;
}

.security-modal .close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.security-modal .modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.user-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row .danger {
    color: #dc3545;
    font-weight: bold;
}

.event-types-breakdown {
    margin-bottom: 20px;
}

.event-types-breakdown h4 {
    color: #333;
    margin-bottom: 10px;
}

.type-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.type-stat:last-child {
    border-bottom: none;
}

.recent-user-events h4 {
    color: #333;
    margin-bottom: 10px;
}

.recent-user-events .events-list {
    max-height: 200px;
}

.recent-user-events .event-item {
    padding: 10px;
    margin-bottom: 5px;
}

.event-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin-bottom: 5px;
}

.event-page {
    font-size: 0.8rem;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .refresh-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .security-stats-grid {
        grid-template-columns: 1fr;
    }

    .event-details {
        grid-template-columns: 1fr;
    }

    .violator-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .violator-rank {
        min-width: auto;
    }
}

/* Alert Styles */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.no-events, .no-violators {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

.error-message h3 {
    color: #721c24;
    margin-bottom: 15px;
}

.error-message .btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.error-message .btn:hover {
    background: #0056b3;
}