/* wwwroot/css/site.css */

/* Import Lato font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

/* Define base variables for light mode */
:root {
    --mh-primary: #193654; /* Maine's Blue - Darker, professional */
    --mh-primary-light: #2c5a7d; /* Lighter variant for hover states */
    --mh-accent: #5a8fb8; /* Supporting accent - softer blue */
    --mh-secondary: #e0e0e0;

    /* Override Bootstrap primary color variables */
    --bs-primary: #193654;
    --bs-primary-rgb: 25, 54, 84;
    --bs-link-color: #193654;
    --bs-link-hover-color: #2c5a7d;

    /* Font family */
    --mh-font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Apply Lato font to body and all elements */
body {
    font-family: var(--mh-font-family);
}

h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: var(--mh-font-family);
}

/* Apply dark mode variables when the attribute is toggled on the html tag */
[data-bs-theme="dark"] {
    --mh-primary: #2c5a7d; /* Slightly lighter for dark mode readability */
    --mh-primary-light: #3d6d98;
    --mh-accent: #6a9fc8;
    --mh-secondary: #333333;

    --bs-primary: #2c5a7d;
    --bs-primary-rgb: 44, 90, 125;
    --bs-link-color: #6a9fc8;
    --bs-link-hover-color: #8bb4d9;
}

/* Apply Maine House primary color to Bootstrap classes */
.bg-primary {
    background-color: var(--mh-primary) !important;
}

.text-primary {
    color: var(--mh-primary) !important;
}

.border-primary {
    border-color: var(--mh-primary) !important;
}

.btn-primary {
    background-color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--mh-primary-light) !important;
    border-color: var(--mh-primary-light) !important;
}

.btn-outline-primary {
    color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
    color: #fff !important;
}

.btn-outline-primary:active {
    background-color: var(--mh-primary-light) !important;
    border-color: var(--mh-primary-light) !important;
    color: #fff !important;
}

.badge.bg-primary {
    background-color: var(--mh-primary) !important;
}

/* Fixed-width badge for district numbers (1-3 digits) */
.badge-district {
    min-width: 2.5rem;
    text-align: center;
    display: inline-block;
}

/* ===========================
   MEGA MENU STYLES
   =========================== */

/* Mega menu dropdown container */
.mega-menu .mega-dropdown {
    min-width: 600px;
    max-width: 800px;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 0;
}

/* Dropdown headers with icons */
.mega-dropdown .dropdown-header {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    margin-bottom: 0.25rem;
}

/* Dropdown items styling */
.mega-dropdown .dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border-radius: 0.25rem;
    margin: 0.125rem 0;
}

.mega-dropdown .dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
    transform: translateX(4px);
}

/* Icon styling for all navbar dropdown items (mega and regular) */
.mega-dropdown .dropdown-item i,
.navbar-nav .dropdown-menu .dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 0.5rem;
    opacity: 0.7;
}

.mega-dropdown .dropdown-item:hover i,
.navbar-nav .dropdown-menu .dropdown-item:hover i {
    opacity: 1;
}

/* Consistent hover effect for regular dropdowns */
.navbar-nav .dropdown-menu .dropdown-item {
    transition: all 0.2s ease;
    border-radius: 0.25rem;
    margin: 0.125rem 0.5rem;
}

.navbar-nav .dropdown-menu .dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
    transform: translateX(4px);
}

/* ===========================
   HOVER DROPDOWN ON DESKTOP
   =========================== */
@media (min-width: 992px) {
    /* Show dropdown on hover for desktop */
    .navbar-nav .nav-item.dropdown:hover > .dropdown-menu,
    .navbar-nav .nav-item.dropdown:hover > .mega-dropdown {
        display: block;
        margin-top: 0;
    }

    /* Smooth fade-in animation */
    .navbar-nav .dropdown-menu,
    .navbar-nav .mega-dropdown {
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        display: block !important;
    }

    .navbar-nav .nav-item.dropdown:hover > .dropdown-menu,
    .navbar-nav .nav-item.dropdown:hover > .mega-dropdown {
        opacity: 1;
        visibility: visible;
    }

    /* Prevent gap between nav-link and dropdown - only for mega-menu items */
    .navbar-nav .nav-item.dropdown.mega-menu > .nav-link {
        padding-bottom: 1rem;
        margin-bottom: -0.5rem;
    }

    /* Regular dropdown menus (Committees, Contact) use normal padding */
    .navbar-nav .nav-item.dropdown:not(.mega-menu) > .nav-link {
        padding-bottom: 0.5rem;
    }

    /* Constrain width of regular dropdown menus */
    .navbar-nav .nav-item.dropdown:not(.mega-menu) .dropdown-menu {
        min-width: 250px;
        max-width: 300px;
    }
}

/* Hover effect for nav items */
.navbar-nav .nav-link {
    transition: all 0.2s ease;
    position: relative;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--bs-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.show::after {
    width: 80%;
}

/* Mobile accordion styling - SCOPED to offcanvas menu only */
.offcanvas .accordion-button:focus {
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.offcanvas .accordion-button:not(.collapsed) {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Regular page accordion buttons - keep default Bootstrap styling */
.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(25, 54, 84, 0.25);
}

.accordion-button:not(.collapsed) {
    color: var(--mh-primary);
    background-color: rgba(25, 54, 84, 0.05);
}

/* Mobile menu items */
.offcanvas-body .dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border-radius: 0.25rem;
}

.offcanvas-body .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

/* Sticky header shadow when scrolling */
.sticky-top {
    transition: box-shadow 0.3s ease;
}

.sticky-top.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* External link icon styling */
.dropdown-item .fa-external-link-alt {
    opacity: 0.5;
    margin-left: 0.25rem;
}

/* Dropdown dividers */
.dropdown-divider {
    margin: 0.75rem 0;
    opacity: 0.5;
}

/* ===========================
   HOMEPAGE HERO & CARDS
   =========================== */

/* Hero section */
.hero-section {
    min-height: 400px;
    overflow: hidden;
}

.min-vh-50 {
    min-height: 50vh;
}

/* Hero slider positioning */
.hero-section .slider-container {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-section .slider-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Quick link cards */
.quick-link-card {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.quick-link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.icon-circle {
    transition: all 0.3s ease;
}

.quick-link-card:hover .icon-circle {
    transform: scale(1.1);
}

/* Hero Find Your Representative button animation */
.btn-hero-find {
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-hero-find .hero-icon {
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.btn-hero-find:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.4), 0 0 30px rgba(255, 255, 255, 0.2);
}

.btn-hero-find:hover .hero-icon {
    transform: translateX(8px) scale(1.2);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Welcome card */
.welcome-card {
    border-left: 4px solid var(--mh-primary);
}

/* Session highlights card */
.session-highlights-card .highlight-item {
    transition: all 0.2s ease;
}

.session-highlights-card .highlight-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin: -0.5rem;
}

/* List group hover effects */
.list-group-item-action {
    transition: all 0.2s ease;
}

.list-group-item-action:hover {
    background-color: rgba(0, 0, 0, 0.03);
    border-left: 3px solid var(--mh-primary);
    padding-left: 1.25rem;
}

/* Active list group item - use brand colors instead of Bootstrap blue */
.list-group-item-action.active {
    background-color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
    color: white !important;
}

.list-group-item-action.active:hover {
    background-color: var(--mh-primary-light) !important;
    border-color: var(--mh-primary-light) !important;
    color: white !important;
}

/* Responsive hero adjustments */
@media (max-width: 768px) {
    .hero-section {
        min-height: 300px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section .lead {
        font-size: 1.1rem;
    }
}

/* Card header styling */
.card-header h4 {
    font-weight: 600;
}

/* Button hover enhancements */
.btn-outline-danger:hover,
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-info:hover,
.btn-outline-warning:hover,
.btn-outline-secondary:hover,
.btn-outline-dark:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Month filter button hover - use primary color */
.btn-outline-secondary:hover {
    background-color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
    color: white !important;
}

/* Month Filter Button Group - Mobile Friendly */
.month-filter-group {
    width: 100%;
    gap: 0.5rem;
}

.month-filter-btn {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    font-weight: 500;
    min-width: 60px;
    transition: all 0.2s ease;
}

/* Mobile: Larger buttons with better touch targets */
@media (max-width: 767px) {
    .month-filter-btn {
        font-size: 1.1rem;
        padding: 0.875rem 1rem;
        min-width: 70px;
        flex: 1 1 auto;
    }

    .month-filter-group {
        gap: 0.75rem;
    }
}

/* Tablet and Desktop: Reduced padding to fit all months in one row */
@media (min-width: 768px) {
    .month-filter-btn {
        font-size: 0.95rem;
        padding: 0.75rem 0.85rem;
    }
}

/* ===========================
   SESSION TIMELINE
   =========================== */

/* Timeline styling */
.session-timeline .timeline {
    position: relative;
}

/* Timeline connector line (desktop only) */
@media (min-width: 768px) {
    .session-timeline .timeline::before {
        content: '';
        position: absolute;
        left: 33.33%;
        top: 20px;
        bottom: 20px;
        width: 2px;
        background: linear-gradient(to bottom,
            var(--bs-primary) 0%,
            var(--bs-secondary) 33%,
            var(--bs-info) 66%,
            var(--bs-success) 100%);
        opacity: 0.3;
        margin-left: 7px;
    }
}

/* Timeline item styling */
.timeline-item {
    position: relative;
}

.timeline-item .timeline-dot {
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 4px white, 0 0 0 6px rgba(0, 0, 0, 0.1);
}

/* Badge hover effect */
.timeline-item .badge {
    transition: all 0.2s ease;
}

.timeline-item:hover .badge {
    transform: scale(1.05);
}

/* Timeline content animation on hover */
.timeline-content {
    transition: all 0.2s ease;
}

.timeline-item:hover .timeline-content {
    transform: translateX(4px);
}

/* Mobile timeline adjustments */
@media (max-width: 767px) {
    .timeline-item {
        border-left: 2px solid rgba(0, 0, 0, 0.1);
        padding-left: 1rem;
        margin-left: 0.5rem;
    }

    .timeline-item:last-child {
        border-left-color: transparent;
    }
}

/* ===========================
   CUSTOM SCHEDULE GRID SYSTEM
   (Avoids DataTables .row/.col conflicts)
   =========================== */

/* Custom grid container - does NOT use Bootstrap's .row class */
.schedule-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Custom column class - does NOT use Bootstrap's .col-* classes */
.schedule-col {
    flex: 0 0 100%;
    min-width: 0;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .schedule-col {
        flex: 0 0 calc(50% - 0.75rem);
        max-width: calc(50% - 0.75rem);
    }
}

/* Desktop: 3 columns */
@media (min-width: 992px) {
    .schedule-col {
        flex: 0 0 calc(33.333% - 1rem) !important;
        max-width: calc(33.333% - 1rem) !important;
        width: calc(33.333% - 1rem) !important;
    }
}

/* Custom styles for your project go here */

/* ===========================
   DATATABLES CUSTOMIZATION
   =========================== */

/* DataTables pagination - use our primary color for active page */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--mh-primary-light) !important;
    border-color: var(--mh-primary-light) !important;
    color: white !important;
}

/* Page-item for Bootstrap 5 styled pagination */
.page-item.active .page-link {
    background-color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
}

.page-link {
    color: var(--mh-primary);
}

.page-link:hover {
    color: var(--mh-primary-light);
    background-color: #e9ecef;
}

/* ===========================
   ACCORDION ENHANCEMENTS
   =========================== */

/* Accordion button - keep content visible when collapsed */
.accordion-button::after {
    flex-shrink: 0;
    margin-left: auto;
}

/* Ensure badges stay visible in accordion headers */
.accordion-button .badge {
    position: relative;
    z-index: 1;
}

/* ===========================
   DISTRICT CARD ENHANCEMENTS
   =========================== */

/* Chevron icon rotation for expand/collapse */
.district-card .chevron-icon {
    transition: transform 0.3s ease;
}

.district-card .collapsed .chevron-icon {
    transform: rotate(-90deg);
}

/* Show more link styling */
.show-more-towns {
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-more-towns:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* ===========================
   MEMBER PROFILES INDEX PAGE
   =========================== */

/* Member card hover effects */
.member-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Consistent photo sizing with aspect ratio */
.member-photo-container {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 aspect ratio */
    overflow: hidden;
}

.member-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* Card title truncation for long names */
.member-card .card-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Animation for search/sort filtering */
.member-item {
    transition: opacity 0.2s ease-in-out;
}

.member-item.hidden {
    display: none !important;
}

/* Stats cards - clickable party filter cards */
.stats-card {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.stats-card.active {
    transform: scale(1.05);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Sort button active state - use our primary color */
.sort-btn.active {
    background-color: var(--mh-primary) !important;
    border-color: var(--mh-primary) !important;
    color: #fff !important;
    box-shadow: 0 0 0 3px rgba(25, 54, 84, 0.25);
}

.sort-btn.active:hover {
    background-color: var(--mh-primary-light) !important;
    border-color: var(--mh-primary-light) !important;
}

/* Speaker horizontal layout */
.speaker-section {
    background: linear-gradient(135deg, rgba(25, 54, 84, 0.03) 0%, rgba(25, 54, 84, 0.08) 100%);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.speaker-photo-container {
    width: 225px;
    height: 275px;
    overflow: hidden;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.speaker-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* Large soft gavel background for speaker section */
.speaker-gavel-bg {
    position: absolute;
    right: 1rem;
    bottom: -1rem;
    font-size: 12rem;
    color: rgba(25, 54, 84, 0.06);
    transform: rotate(-15deg);
    pointer-events: none;
    z-index: 0;
}

@media (max-width: 767px) {
    .speaker-gavel-bg {
        font-size: 8rem;
        right: 0.5rem;
        bottom: -0.5rem;
    }
}

@media (max-width: 575px) {
    .speaker-photo-container {
        width: 175px;
        height: 215px;
    }

    .speaker-section {
        padding: 1rem;
    }
}

/* Clickable card links - whole card is clickable */
a.text-decoration-none .member-card {
    cursor: pointer;
}

a.text-decoration-none:hover .member-card {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Leadership card styling - +10% larger than normal */
.leadership-card {
    border-width: 2px !important;
}

/* Leadership item sizing - approximately 10% larger than normal cards */
/* Normal cards: 6 per row at xl (16.67% each) */
/* Leadership: ~5.5 per row at xl (18.18% each) = ~10% larger */
.leadership-item {
    flex: 0 0 50% !important;
    max-width: 50% !important;
}

@media (min-width: 576px) {
    .leadership-item {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
}

@media (min-width: 768px) {
    .leadership-item {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}

@media (min-width: 992px) {
    .leadership-item {
        flex: 0 0 20% !important;
        max-width: 20% !important;
    }
}

@media (min-width: 1200px) {
    /* ~5.5 columns = 18.18% width (10% larger than normal 16.67%) */
    .leadership-item {
        flex: 0 0 18.18% !important;
        max-width: 18.18% !important;
    }
}

/* Section titles for filtering toggle */
.section-title {
    transition: opacity 0.2s ease-in-out;
}

.section-title.filtered-hidden {
    display: none !important;
}