/* ==========================================================================
   Crime Radar - Main Stylesheet
   ========================================================================== */

/* Base Styles
   ========================================================================== */
body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Layout Components
   ========================================================================== */
.events-table {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.filter-section {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Table Styles
   ========================================================================== */
.table th {
    background-color: #007bff;
    color: white;
    border: none;
    font-weight: 600;
    padding: 1rem;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* TFS Event Styling - Light Red Background */
.events-table .table tbody tr.tfs-event {
    background-color: #fef2f2 !important; /* Very light red background */
    border-left: 4px solid #ef4444 !important; /* Red accent border */
}

.events-table .table tbody tr.tfs-event:hover {
    background-color: #fee2e2 !important; /* Slightly darker on hover */
    transform: translateX(2px); /* Subtle hover animation */
    transition: all 0.2s ease;
}

/* Optional: Add a subtle box shadow for TFS events */
.events-table .table tbody tr.tfs-event td {
    border-bottom-color: #fecaca !important; /* Matching border color */
}

/* Event Display Styles
   ========================================================================== */
.event-time {
    color: #495057;
    font-weight: 500;
}

.event-district {
    background-color: #007bff;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.event-type {
    font-weight: 600;
    color: #495057;
    font-size: 1.1em;
    line-height: 1.4;
}

/* Emoji styling */
.event-type {
    font-size: 1.1em;
}

.event-type emoji {
    font-size: 1.2em;
    margin-right: 4px;
}

.location-link {
    color: #20c997;
    text-decoration: none;
    font-weight: 500;
    word-break: break-word;
    display: inline-block;
    max-width: 100%;
}

.location-link:hover {
    color: #17a2b8;
    text-decoration: underline;
}

/* Status & State Displays
   ========================================================================== */
.badge-count {
    background-color: #dc3545;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
}

.no-events {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.loading {
    text-align: center;
    padding: 3rem;
}

/* Action Buttons
   ========================================================================== */
.refresh-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Responsive Design
   ========================================================================== */

/* iPhone 12 and larger mobile devices (390px and up) */
@media (max-width: 767px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .filter-section {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    /* Mobile table styles */
    .events-table {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    /* Adjust table column widths for mobile */
    .table th:first-child,
    .table td:first-child {
        width: 20%;
        min-width: 70px;
        max-width: 100px;
    }
    
    .table th:nth-child(2),
    .table td:nth-child(2) {
        width: auto;
        min-width: 120px;
        max-width: none;
    }
    
    .table th:nth-child(3),
    .table td:nth-child(3) {
        width: 35%;
        min-width: 100px;
    }
    
    /* Improve location link display on mobile */
    .location-link {
        font-size: 0.85rem;
        line-height: 1.3;
        word-break: break-all;
        hyphens: auto;
    }
    
    /* Adjust event type display */
    .event-type {
        font-size: 0.9rem;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Adjust event time and district display */
    .event-time {
        font-size: 0.8rem;
    }
    
    .event-district {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .refresh-btn {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    /* Improve navbar for mobile */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-text {
        font-size: 0.8rem;
    }
    
    /* Adjust main heading */
    h4 {
        font-size: 1.3rem;
    }
    
    /* Improve ward info box on mobile */
    #wardInfoBox .card-body {
        padding: 1rem;
    }
    
    #wardInfoBox h6 {
        font-size: 1rem;
    }
}

/* iPhone 6/7/8 and smaller devices (375px and below) */
@media (max-width: 375px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .filter-section {
        padding: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Further reduce column widths for very small screens */
    .table th:first-child,
    .table td:first-child {
        width: 18%;
        min-width: 60px;
        max-width: 80px;
    }
    
    .table th:nth-child(2),
    .table td:nth-child(2) {
        width: auto;
        min-width: 100px;
        max-width: none;
    }
    
    .table th:nth-child(3),
    .table td:nth-child(3) {
        width: 40%;
        min-width: 90px;
    }
    
    .location-link {
        font-size: 0.8rem;
    }
    
    .event-type {
        font-size: 0.85rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .event-time {
        font-size: 0.75rem;
    }
    
    .event-district {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
    
    .refresh-btn {
        width: 45px;
        height: 45px;
        bottom: 10px;
        right: 10px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-text {
        font-size: 0.75rem;
    }
    
    h4 {
        font-size: 1.2rem;
    }
}

/* iPhone 12 Pro Max and larger devices (428px and up) */
@media (min-width: 428px) and (max-width: 767px) {
    .table th,
    .table td {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .location-link {
        font-size: 0.9rem;
    }
    
    .event-type {
        font-size: 0.95rem;
    }
}

/* Tablet and larger devices (768px and up) */
@media (min-width: 768px) {
    .table th,
    .table td {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    .location-link {
        font-size: 1rem;
    }
    
    .event-type {
        font-size: 1.1rem;
    }
}

/* Accessibility
   ========================================================================== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus styles for better keyboard navigation */
.location-link:focus,
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Animations
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.events-table {
    animation: fadeIn 0.3s ease-in-out;
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.refresh-btn i {
    transition: transform 0.3s ease;
}

.refresh-btn:hover i {
    transform: rotate(180deg);
}
