/* 1. Global Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #222;
    line-height: 1.5;
}

.alerts-page {
    max-width: 960px;
    margin: 70px auto;
    padding: 60px 20px;
    min-height: 100vh;
}

/* 2. Header Section */
.alerts-header h1 {
    margin: 0 0 40px;
    text-align: center;
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #000;
}

/* 3. Filter System */
.alerts-filters {
    display: flex;
    justify-content: center;
    margin-bottom: 50px;
}

.filter-row-wrapper {
    display: flex;
    gap: 16px;
    align-items: center;
}

.filter-static-box,
.filter-select,
.filter-input {
    height: 48px;
    width: 220px;
    padding: 0 15px;
    border: 1px solid #767676;
    background-color: #fff;
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    border-radius: 0;
    display: flex;
    align-items: center;
    transition: border-color 0.2s;
}

.filter-static-box {
    cursor: default;
    user-select: none;
}

.filter-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 12px auto;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #000;
}

/* 4. Alerts List & Cards */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 60px;
}

.alert-card {
    display: flex;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #eaeaea;
    border-radius: 4px;
    overflow: hidden;
}

.alert-side-strip {
    width: 12px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
    padding: 20px 24px;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.alert-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: #ffffff;
    flex-shrink: 0;
}

/* Severity Shapes */
.alert-critical .alert-icon,
.alert-warning .alert-icon {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    padding-top: 5px;
}

.alert-info .alert-icon,
.alert-resolved .alert-icon {
    border-radius: 50%;
}

.alert-title-group {
    flex: 1;
}

.alert-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.alert-location {
    margin: 4px 0 0;
    font-size: 1rem;
    color: #666;
}

.alert-footer {
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #888;
}

.alert-action-button {
    color: black;
    background: white;
    border: 1px solid black;
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.2s;
}

.alert-action-button:hover {
    background: #f9f9f9;
}

/* Severity Colors */
.alert-critical .alert-side-strip,
.alert-critical .alert-icon { background-color: #e41b13; }
.alert-critical .alert-title { color: #e41b13; }

.alert-warning .alert-side-strip,
.alert-warning .alert-icon { background-color: #ffd600; color: #000; }
.alert-warning .alert-title { color: #d4a017; }

.alert-info .alert-side-strip,
.alert-info .alert-icon { background-color: #0066ff; }
.alert-info .alert-title { color: #0066ff; }

.alert-resolved .alert-side-strip,
.alert-resolved .alert-icon { background-color: #1f8b3b; }
.alert-resolved .alert-title { color: #1f8b3b; }

/* 5. Legend Section */
.alerts-legend {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.legend-dot {
    width: 14px;
    height: 14px;
}

.legend-critical { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); background-color: #e41b13; }
.legend-warning { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); background-color: #ffd600; }
.legend-info { border-radius: 50%; background-color: #0066ff; }
.legend-resolved { border-radius: 50%; background-color: #1f8b3b; }

/* 6. Modal System (Strict MVC) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: none; /* Hidden by default */
    z-index: 1000;
}

.modal-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    z-index: 1001;
    width: 90%;
    max-width: 550px;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    display: none; /* Hidden by default */
}

/* The "Magic" class JS toggles */
.modal-active {
    display: block !important;
}

.modal-body { 
    margin: 25px 0; 
    line-height: 1.7; 
    font-size: 1.1rem; 
}

.modal-footer-time {
    color: #888;
    margin-bottom: 20px;
}

/* 7. Responsive Design */
@media (max-width: 850px) {
    .filter-row-wrapper {
        flex-direction: column;
        width: 100%;
    }
    .filter-static-box, .filter-select, .filter-input {
        width: 100%;
    }
    .alert-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .alert-action-button {
        width: 100%;
        text-align: center;
    }
    .alerts-legend {
        flex-wrap: wrap;
        gap: 20px;
    }
}