/* 
 * Traffic Alerts WordPress Plugin CSS - Updated Version
 */

#header {
    z-index: 3 !important;
}

.bc-traffic-alerts {
    --primary-color: #105673;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 10px;
    --border-radius-lg: 15px;
    --box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Mobile-Responsive Alert List Styles */
.bc-traffic-alerts .alerts-container {
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: white;
}

.bc-traffic-alerts .alerts-header {
    background-color: var(--light-color);
    border-bottom: 2px solid #dee2e6;
    padding: 12px 15px;
    font-weight: 600;
    color: #495057;
}

.bc-traffic-alerts .alert-header-item {
    padding: 0 8px;
    display: flex;
    align-items: center;
}

.bc-traffic-alerts .alert-item {
    border-bottom: 1px solid #dee2e6;
    transition: background-color 0.2s ease;
    padding: 15px;
}

.bc-traffic-alerts .alert-item:last-child {
    border-bottom: none;
}

.bc-traffic-alerts .alert-item:hover {
    background-color: var(--light-color);
}

.bc-traffic-alerts .alert-item.no-alerts {
    padding: 30px;
    text-align: center;
    color: #6c757d;
}

/* Desktop table layout fixes - Text overflow control */
.bc-traffic-alerts .alert-row {
    display: flex;
    align-items: stretch;
    min-height: 60px;
}

.bc-traffic-alerts .alert-cell {
    padding: 0 8px;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    min-width: 0; /* Critical for flex children to allow shrinking */
}

.bc-traffic-alerts .alert-cell > div {
    width: 100%;
    min-width: 0;
}

.bc-traffic-alerts .alert-cell strong {
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.bc-traffic-alerts .alert-cell small {
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Specific column width enforcement */
.bc-traffic-alerts .alert-header-item,
.bc-traffic-alerts .alert-cell {
    flex-shrink: 0; /* Prevent columns from shrinking below their flex basis */
}

/* Badge wrapping in table cells */
.bc-traffic-alerts .alert-cell .badge {
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.4;
    padding: 0.35em 0.5em;
    max-width: 100%;
}
/****End of desktop table layout fix*****/

.bc-traffic-alerts .alert-row {
    padding: 12px 15px;
    align-items: center;
    min-height: 60px;
}

.bc-traffic-alerts .alert-cell {
    padding: 0 8px;
    display: flex;
    align-items: center;
}

/* Category Badge Styling */
.bc-traffic-alerts .category-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}

.bc-traffic-alerts .badge-sm {
    font-size: 0.7rem;
    padding: 2px 6px;
}

/* Severity Badge Styling */
.bc-traffic-alerts .severity-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}

/* Category Color Classes */
.bc-traffic-alerts .bg-hurricane {
    background-color: #dc3545 !important;
    color: white !important;
}

.bc-traffic-alerts .bg-flooding-closed {
    background-color: #007bff !important;
    color: white !important;
}

.bc-traffic-alerts .bg-flooding-caution {
    background-color: #17a2b8 !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-ice-snow {
    background-color: #f8f9fa !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-high-winds {
    background-color: #6c757d !important;
    color: white !important;
}

.bc-traffic-alerts .bg-severe-weather {
    background-color: #ffc107 !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-traffic-light {
    background-color: #ffc107 !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-bridge-closure {
    background-color: #dc3545 !important;
    color: white !important;
}

.bc-traffic-alerts .bg-road-construction {
    background-color: #ffc107 !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-utility-work {
    background-color: #17a2b8 !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-sinkhole {
    background-color: #dc3545 !important;
    color: white !important;
}

.bc-traffic-alerts .bg-emergency {
    background-color: #dc3545 !important;
    color: white !important;
}

.bc-traffic-alerts .bg-accident {
    background-color: #dc3545 !important;
    color: white !important;
}

.bc-traffic-alerts .bg-special-event {
    background-color: #28a745 !important;
    color: white !important;
}

.bc-traffic-alerts .bg-maintenance {
    background-color: #6c757d !important;
    color: white !important;
}

.bc-traffic-alerts .bg-debris {
    background-color: #6c757d !important;
    color: white !important;
}

.bc-traffic-alerts .bg-general-advisory {
    background-color: #17a2b8 !important;
    color: #343a40 !important;
}

.bc-traffic-alerts .bg-other {
    background-color: #343a40 !important;
    color: white !important;
}

/* Sort Link Styling */
.bc-traffic-alerts .sort-link {
    color: #495057;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.bc-traffic-alerts .sort-link:hover {
    color: #007bff;
    text-decoration: none;
}

.bc-traffic-alerts .sort-link i {
    font-size: 0.8em;
}

/* NEW: Combined Legend Section */
.bc-traffic-alerts .legend-section {
    margin-bottom: 20px;
}

.bc-traffic-alerts .legend-item {
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 8px;
}

.bc-traffic-alerts .legend-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 5px;
    white-space: normal;
    word-wrap: break-word;
    display: inline-block;
    max-width: 100%;
    line-height: 1.2;
}

/* Severity Legend Specific Styling */
.bc-traffic-alerts .legend-section h5 {
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.bc-traffic-alerts .legend-section h6 {
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* Form Controls */
.bc-traffic-alerts .form-control,
.bc-traffic-alerts .form-select {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
    margin-top: 0px !important;
    margin-bottom: 0px !important;
}

.bc-traffic-alerts .form-control:focus,
.bc-traffic-alerts .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(16, 86, 115, 0.25);
}

/* Button Styles */
.bc-traffic-alerts .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: var(--border-radius);
}

.bc-traffic-alerts .btn-primary:hover {
    background-color: #0e4a5f;
    border-color: #0e4a5f;
}

.bc-traffic-alerts .btn-outline-secondary {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    font-weight: 500;
    text-decoration: none;
}

.bc-traffic-alerts .btn-outline-secondary:hover {
    text-decoration: none;
}

/* Badge Text Wrapping */
.bc-traffic-alerts .text-wrap {
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .bc-traffic-alerts .alert-item {
        padding: 15px;
    }

    .bc-traffic-alerts .alert-item+.bc-traffic-alerts .alert-item {
        border-top: 1px solid #dee2e6;
    }

    .bc-traffic-alerts .category-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .bc-traffic-alerts .severity-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    /* Alert Details Mobile Fixes */
    .bc-traffic-alerts .badge.fs-6 {
        font-size: 0.75rem !important;
        padding: 6px 10px;
        line-height: 1.2;
        white-space: normal;
        word-wrap: break-word;
        display: inline-block;
        max-width: 100%;
        text-align: center;
    }

    /* Stack status items vertically on very small screens */
    .bc-traffic-alerts .d-flex.gap-2.flex-wrap {
        gap: 0.5rem !important;
    }

    .bc-traffic-alerts .d-flex.gap-2.flex-wrap .badge {
        margin-bottom: 0.25rem;
    }

    /* Legend responsive adjustments */
    .bc-traffic-alerts .legend-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
        margin-bottom: 3px;
    }
}

@media (max-width: 576px) {
    .bc-traffic-alerts .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .bc-traffic-alerts .card-body {
        padding: 15px;
    }

    /* Adjust legend for very small screens */
    .bc-traffic-alerts .legend-section .row {
        margin: 0;
    }
    
    .bc-traffic-alerts .legend-section .col-md-6,
    .bc-traffic-alerts .legend-section .col-md-3 {
        padding: 0 5px;
        margin-bottom: 15px;
    }
}

/* Animation Classes */
.bc-traffic-alerts .fade-in {
    animation: bcFadeIn 0.5s ease-in;
}

@keyframes bcFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bc-traffic-alerts .slide-in {
    animation: bcSlideIn 0.3s ease-out;
}

@keyframes bcSlideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Loading States */
.bc-traffic-alerts .btn-loading {
    position: relative;
    pointer-events: none;
}

.bc-traffic-alerts .btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    animation: bcSpin 1s linear infinite;
}

@keyframes bcSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal Enhancements with proper z-index handling */
.bc-traffic-alerts .modal {
    z-index: 10000 !important;
    /* Higher than typical WordPress elements */
}

.bc-traffic-alerts .modal-backdrop {
    z-index: 9999 !important;
    /* Just below the modal but above other elements */
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Ensure backdrop is always behind modal */
.modal-backdrop.show {
    /*z-index: 9999 !important;*/
    opacity: 0.5 !important;
}

.bc-traffic-alerts .modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10000 !important;
}

.bc-traffic-alerts .modal-dialog {
    margin: 3rem auto !important;
    /* Add more top margin for better centering */
    position: relative;
    z-index: 10001 !important;
}

/* Ensure modal is properly centered and spaced */
@media (min-width: 576px) {
    .bc-traffic-alerts .modal-dialog {
        margin: 5rem auto !important;
        max-width: 90vw;
    }
}

@media (min-width: 992px) {
    .bc-traffic-alerts .modal-dialog {
        margin: 3rem auto !important;
        max-width: 800px;
    }
}

.bc-traffic-alerts .modal-header {
    background: #005677;
    color: white;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    position: relative;
    z-index: 10002 !important;
}

.bc-traffic-alerts .modal-header .btn-close {
    filter: invert(1);
    z-index: 10003 !important;
    position: relative;
}

.bc-traffic-alerts .modal-body {
    position: relative;
    z-index: 10001 !important;
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Fix for WordPress themes with fixed headers */
body.modal-open {
    padding-right: 0 !important;
    /* Prevent body shift */
}

/* Ensure Bootstrap modal backdrop works properly */
.bc-traffic-alerts .modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.bc-traffic-alerts .modal.show .modal-dialog {
    transform: none;
}

/* Card Enhancements */
.bc-traffic-alerts .card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.bc-traffic-alerts .card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    font-weight: 600;
}

/* Alert Status Colors */
.bc-traffic-alerts .status-active {
    color: var(--success-color);
}

.bc-traffic-alerts .status-upcoming {
    color: var(--info-color);
}

.bc-traffic-alerts .status-expired {
    color: var(--secondary-color);
}

/* Pagination Styling */
.bc-traffic-alerts .pagination {
    margin-top: 2rem;
    margin-bottom: 0;
}

.bc-traffic-alerts .pagination .page-link {
    border-radius: var(--border-radius);
    margin: 0 2px;
    color: var(--primary-color);
    border: 2px solid #e9ecef;
}

.bc-traffic-alerts .pagination .page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.bc-traffic-alerts .pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* WordPress Theme Compatibility */
.bc-traffic-alerts * {
    box-sizing: border-box;
}

/* Override any theme styles that might conflict */
.bc-traffic-alerts .btn {
    font-family: inherit;
    line-height: 1.5;
}

.bc-traffic-alerts .card {
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, .125);
}

.bc-traffic-alerts .alert {
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

/* Ensure proper spacing */
.bc-traffic-alerts .mb-0 {
    margin-bottom: 0 !important;
}

.bc-traffic-alerts .mb-1 {
    margin-bottom: 0.25rem !important;
}

.bc-traffic-alerts .mb-2 {
    margin-bottom: 0.5rem !important;
}

.bc-traffic-alerts .mb-3 {
    margin-bottom: 1rem !important;
}

.bc-traffic-alerts .mb-4 {
    margin-bottom: 1.5rem !important;
}

.bc-traffic-alerts .mb-5 {
    margin-bottom: 3rem !important;
}

.bc-traffic-alerts .me-1 {
    margin-right: 0.25rem !important;
}

.bc-traffic-alerts .me-2 {
    margin-right: 0.5rem !important;
}

.bc-traffic-alerts .ms-1 {
    margin-left: 0.25rem !important;
}

.bc-traffic-alerts .ms-2 {
    margin-left: 0.5rem !important;
}

/* Specific fixes for theme conflicts */
/* Override conflicting fixed header styles */
.bc-traffic-alerts .modal.show {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Ensure modal content is clickable and properly positioned */
.bc-traffic-alerts .modal-content {
    pointer-events: all !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    background-color: #fff !important;
    background-clip: padding-box !important;
    outline: 0 !important;
}

/* Print Styles */
@media print {

    .bc-traffic-alerts .btn,
    .bc-traffic-alerts .pagination,
    .bc-traffic-alerts .modal,
    .bc-traffic-alerts .legend-section {
        display: none !important;
    }

    .bc-traffic-alerts .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
        break-inside: avoid;
    }

    .bc-traffic-alerts .alert-item {
        break-inside: avoid;
    }
}


