/* Security Monitor Styles */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
}

.security-container {
    max-width: 1400px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.page-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1rem;
}

.last-updated {
    margin: 0.5rem 0 0 0;
    opacity: 0.75;
    font-size: 0.9rem;
    font-style: italic;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.stat-icon.critical { background: #fee; }
.stat-icon.high { background: #ffe; }
.stat-icon.medium { background: #fef; }
.stat-icon.low { background: #eff; }
.stat-icon.blocked { background: #ffe0e0; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    padding: 0 2rem;
    background: #f0f0f0;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

/* Tab Content */
.tab-content {
    padding: 2rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Filter Bar */
.filter-bar, .action-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-select, .filter-input {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.filter-select {
    min-width: 180px;
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Matches List */
.matches-list, .patterns-list, .ips-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-card, .pattern-card, .ip-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s;
}

.match-card:hover, .pattern-card:hover, .ip-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.match-header, .pattern-header, .ip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.match-info, .pattern-info, .ip-info {
    flex: 1;
}

.match-title, .pattern-title, .ip-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.match-meta, .pattern-meta, .ip-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.severity-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.critical {
    background: #e74c3c;
    color: white;
}

.severity-badge.high {
    background: #e67e22;
    color: white;
}

.severity-badge.medium {
    background: #f39c12;
    color: white;
}

.severity-badge.low {
    background: #3498db;
    color: white;
}

.log-message {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Pattern Actions */
.pattern-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.icon-btn.danger:hover {
    border-color: #e74c3c;
    background: #fee;
    color: #e74c3c;
}

/* IP Cards */
.ip-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.ip-link {
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.ip-link:hover {
    color: #764ba2;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #f0f0ff;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-wide {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .security-container {
        border-radius: 0;
    }
    
    .page-header {
        padding: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .tabs {
        padding: 0 1rem;
        overflow-x: auto;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .match-header, .pattern-header, .ip-header {
        flex-direction: column;
    }
    
    .match-meta, .pattern-meta, .ip-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-bar, .action-bar {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* IP Actions */
.ip-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

.ip-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.ip-details-table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.ip-details-table td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
}

.ip-details-table tr:hover {
    background: #f8f9fa;
}

.ip-details-table tr.ignored {
    opacity: 0.5;
    background: #f0f0f0;
}

.ip-details-table tr.ignored td {
    text-decoration: line-through;
}

.log-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-width: 500px;
    word-break: break-all;
    white-space: pre-wrap;
}

.action-cell {
    text-align: center;
    white-space: nowrap;
}

.action-link {
    color: #667eea;
    cursor: pointer;
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    display: inline-block;
    transition: all 0.2s;
}

.action-link:hover {
    transform: scale(1.2);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.status-ignored {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #95a5a6;
    color: white;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 8px;
    padding: 1em;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f5f5f5;
    padding: 0.75em;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75em;
    border-bottom: 1px solid #eee;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-table tbody tr.row-blocked {
    background-color: #ffe0e0;
}

.data-table tbody tr.row-blocked:hover {
    background-color: #ffd0d0;
}

.data-table tbody tr.row-ignored {
    background-color: #f5f5f5;
    opacity: 0.7;
}

.data-table tbody tr.row-ignored:hover {
    background-color: #ebebeb;
}

.severity-badge.table {
    padding: 0.25em 0.5em;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.severity-badge.table.critical { background: #fee; color: #c00; }
.severity-badge.table.high { background: #ffe; color: #a60; }
.severity-badge.table.medium { background: #fef; color: #90a; }
.severity-badge.table.low { background: #eff; color: #06a; }

.btn-table {
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-table.btn-primary {
    background: #667eea;
    color: white;
}

.btn-table.btn-primary:hover {
    background: #5568d3;
}

.btn-table.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-table.btn-danger:hover {
    background: #c0392b;
}

.btn-table.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-table.btn-warning:hover {
    background: #e67e22;
}

