/* === ROOT VARIABLES === */
:root {
    --primary-blue: #0d6efd;
    --light-gray: #f8f9fa;
    --medium-gray: #dee2e6;
    --dark-gray: #343a40;
    --text-color: #212529;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --card-radius: 8px;
}

/* === GENERAL STYLES === */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.card {
    background-color: #ffffff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
}

.section-heading {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--medium-gray);
    padding-bottom: 0.5rem;
}

/* === HEADER === */
.header {
    background-color: var(--dark-gray);
    color: #ffffff;
    padding: 1rem 0;
    border-bottom: 4px solid var(--primary-blue);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.logo {
    height: 50px;
}

.header h1 {
    margin: 0;
    font-size: 1.75rem;
}
.header p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.9;
}

/* === MAIN LAYOUT === */
.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr; /* Fixed sidebar, flexible content */
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.layout-controls {
    position: sticky; /* Makes sidebar sticky */
    top: 1.5rem;
    align-self: start; /* Aligns to the top */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.layout-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* Fix for flexbox overflow */
}

/* === CONTROLS (LEFT COLUMN) === */
.top-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.council-selector-group,
.search-bar-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-controls label {
    font-weight: 600;
    font-size: 0.9rem;
}

.top-controls select,
.top-controls input[type="search"] {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--medium-gray);
    border-radius: 6px;
    box-sizing: border-box; /* Important for 100% width */
}

.top-controls input[type="search"]:disabled {
    background-color: var(--light-gray);
    cursor: not-allowed;
}

/* === CONTENT (RIGHT COLUMN) === */
#content-display h3 {
    color: var(--primary-blue);
}
#content-display blockquote {
    border-left: 4px solid var(--primary-blue);
    padding-left: 1rem;
    margin-left: 0;
    font-style: italic;
    color: #555;
}

/* Back Button (for Search Results) */
.btn-back-to-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.btn-back-to-nav:hover {
    text-decoration: underline;
}

/* Service Card (for search/category results) */
/* This class is ALSO used inside the expanded kanban cards */
.service-card {
    border: 1px solid var(--medium-gray);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.service-card h3 {
    margin-top: 0;
    color: var(--dark-gray);
}

.service-card p {
    margin: 0.5rem 0;
}

.service-card em {
    font-size: 0.9rem;
    color: #555;
    font-style: normal;
}

.service-card div {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.link-council,
.link-ci {
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
.link-council {
    background-color: var(--primary-blue);
    color: #ffffff;
}
.link-council:hover {
    background-color: #0b5ed7;
}
.link-ci {
    background-color: #f0f0f0;
    color: var(--dark-gray);
    border: 1px solid var(--medium-gray);
}
.link-ci:hover {
    background-color: #e9e9e9;
}


/* === SERVICE NAV ICONS === */
#service-nav {
    padding: 1.5rem;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Disabled state for Nav */
#service-nav.nav-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(80%);
}

/* === PLACEHOLDER SECTIONS === */
.updates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* === FOOTER === */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem 1rem;
    background-color: var(--dark-gray);
    color: #f0f0f0;
    font-size: 0.85rem;
}

.footer p {
    margin: 0.5rem 0;
}

.footer a {
    color: #ffffff;
    font-weight: 600;
}


/* ================================================
 STYLES YOU PROVIDED (FROM faults.tcctiny.me_)
================================================
*/

/* Set the map container to a specific height */
#map {
    height: 600px; /* You can adjust this height */
    width: 100%;
    z-index: 10;
    border-radius: var(--card-radius);
}

/* Custom Leaflet popup style */
.custom-popup .leaflet-popup-content-wrapper {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.custom-popup .leaflet-popup-content {
    margin: 14px;
    font-size: 14px;
    line-height: 1.6;
}
.custom-popup .leaflet-popup-tip {
    background: #ffffff;
}
.popup-header {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}
.popup-body {
    color: #4b5563;
}

/* Loading Spinner */
#loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 8px solid #f3f4f6;
    border-top: 8px solid #3b82f6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    z-index: 20; /* Ensure it's above the map */
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Message Box for errors */
#message-box {
    display: none;
    position: fixed; /* Changed from absolute */
    top: 80px; /* Positioned below the header */
    left: 50%;
    transform: translateX(-50%);
    background-color: #ef4444;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    font-weight: 500;
}

/* --- NEW: Alert Tag Styles --- */
.alert-tag {
    font-size: 0.75rem; /* 12px */
    font-weight: 600;
    padding: 0.25rem 0.75rem; /* py-1 px-3 */
    border-radius: 9999px; /* rounded-full */
    display: inline-block;
}
.alert-red {
    background-color: #fee2e2; /* red-100 */
    color: #b91c1c; /* red-800 */
    border: 1px solid #fca5a5; /* red-300 */
}
.alert-yellow {
    background-color: #fef9c3; /* yellow-100 */
    color: #854d0e; /* yellow-800 */
    border: 1px solid #fde047; /* yellow-300 */
}

/* --- NEW: Card Description Truncation --- */
/* This is used in search results AND expanded cards */
.card-description {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    min-height: 60px; /* 3 lines * 20px line-height */
}


/* --- Custom Pin Icon Styles (Unused by you, but harmless) --- */
.custom-pin-icon-container {
    position: relative;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}
.pin-head {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0; /* Creates the teardrop top */
    transform: rotate(-45deg);
    border: 2px solid #ffffff; /* White border inside */
    box-shadow: 0 0 0 1px #444; /* Darker outline */
    position: absolute;
    left: 0;
    top: 0;
}
.pin-tail {
    width: 14px;
    height: 14px;
    transform: rotate(45deg); /* Point down */
    background-color: inherit; /* Inherits color from JS */
    border-radius: 0 0 4px 0;
    position: absolute;
    left: 5px; /* (24px - 14px) / 2 */
    top: 17px;
    box-shadow: 1px 1px 0 #444;
}
.pin-head::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0.8;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg); /* Un-rotate */
}

/*
================================================
 NEW ACCORDION STYLES (for Audio/Video)
================================================
*/
.media-accordion {
    margin: 1.5rem 0;
    border: 1px solid var(--medium-gray);
    border-radius: var(--card-radius);
    overflow: hidden; /* To keep the border-radius nice */
}

.accordion-item {
    border-bottom: 1px solid var(--medium-gray);
}
.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex; /* Use flexbox for icon and text */
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: var(--light-gray);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--dark-gray);
    list-style: none; /* Remove default marker */
}
.accordion-header::-webkit-details-marker {
    display: none; /* Remove default marker (Chrome/Safari) */
}

.accordion-header:hover {
    background-color: #e9ecef;
}

.accordion-header i {
    color: var(--primary-blue);
    font-size: 1.25rem;
    width: 20px; /* Align text */
    text-align: center;
}

.accordion-content {
    padding: 1rem;
    background-color: #ffffff;
}

/* Style for when the accordion is open */
.accordion-item[open] .accordion-header {
    background-color: #e9ecef;
}

/* UPDATED: Styles for the media players */
.accordion-content audio,
.accordion-content video {
    width: 100%;
}

.accordion-content video {
    aspect-ratio: 16 / 9; /* Enforce 16:9 ratio */
    border-radius: 8px; /* Match the card radius */
    background-color: #000; /* Black background for letterboxing */
}


/*
================================================
 NEW KANBAN CARD STYLES
================================================
*/

.kanban-card {
    background-color: #ffffff;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    border: 2px solid transparent; /* For active state */
}

.kanban-card-header {
    display: flex;
    /* UPDATED: Side-by-side layout */
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 1rem;
    font-size: 1rem; /* UPDATED: Larger text */
    font-weight: 600;
    text-align: left; /* UPDATED: Align text left */
    color: var(--text-color);
    cursor: pointer;
    min-height: 120px; /* UPDATED: Taller header for big icon */
}

.kanban-card-header .btn-icon {
    /* UPDATED: Increased icon size */
    font-size: 3rem;   /* For FontAwesome icons */
    height: 72px;      /* For image icons */
    width: 72px;       /* For image icons */
    object-fit: contain;
    color: var(--primary-blue);
    flex-shrink: 0; /* Prevents icon from shrinking */
}

.kanban-card-header .btn-text {
    line-height: 1.4; /* UPDATED: Better line height for wrapped text */
}

.kanban-card-header:hover {
    background-color: var(--light-gray);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

/* Special "Report It" button */
.kanban-card.report-it-btn {
    background-color: #fff6f6;
    border-color: #f5c6cb;
}
.kanban-card.report-it-btn .kanban-card-header {
    color: #b3000f;
}
.kanban-card.report-it-btn .btn-icon {
    color: #b3000f;
}
.kanban-card.report-it-btn:hover {
    background-color: #fdeded;
}

/* Content area that expands */
.kanban-content-area {
    display: none;
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid var(--medium-gray);
    margin: 0 0.5rem; /* Small indent */
}

/* Active state for the card */
.kanban-card.is-active {
    border-color: var(--primary-blue);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.kanban-card.is-active .kanban-content-area {
    display: block;
}

/* This is the Back button INSIDE the active card */
.btn-close-card {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.btn-close-card:hover {
    text-decoration: underline;
}


/* === RESPONSIVE STYLES === */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr; /* Stack columns */
    }
    .layout-controls {
        position: static; /* Un-stick sidebar */
    }
    .updates-grid {
        grid-template-columns: 1fr; /* Stack placeholders */
    }
    .icon-grid {
        /* On tablets, 3 columns is still good */
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .icon-grid {
        /* UPDATED: Set to 1 column on mobile */
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* UPDATED: Revert to stacked layout on mobile */
    .kanban-card-header {
        flex-direction: column;
        text-align: center;
        font-size: 0.75rem;
        min-height: 90px;
        padding: 1rem 0.5rem;
    }
    .kanban-card-header .btn-icon {
        /* Scale icons down for mobile */
        font-size: 2rem;
        height: 40px;
        width: 40px;
    }
    .kanban-card-header .btn-text {
        line-height: 1.3;
    }

    .card {
        padding: 1rem;
    }
    .container {
        padding: 0 1rem;
    }
    /* Make service-nav card padding smaller on mobile */
    #service-nav.card {
        padding: 1rem;
    }
}