/* --- Global Variables & Reset --- */
:root {
    --primary-color: #001f3f; /* Navy Blue */
    --secondary-color: #FFFFFF; /* White */
    --text-color: #000000; /* Black */
    --header-text: #FFFFFF;
    --border-color: #DDDDDD;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-family: "Libre Baskerville", serif;
    font-weight: 400;
}

h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-family: "Libre Baskerville", serif;
    font-weight: 400;
}

h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-family: "Open Sans", sans-serif;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

/* --- Header & Navigation --- */
.site-header {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    padding: 1rem;
    border-bottom: 3px solid var(--primary-color);
}

/* --- Home Page Specific Styles --- */
.home-page {
    background-color: var(--primary-color);
}

.home-page .chair-text {
    color: var(--secondary-color);
}

.home-page .election-commitment {
    color: #FFFFFF !important;
    font-style: italic !important;
}

.home-page .home-hero .election-commitment {
    color: #FFFFFF !important;
    font-style: italic !important;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    margin-right: 1rem;
    transition: opacity 0.2s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

.logo {
    width: 50px;
    height: 50px;
    display: block;
}

.site-header h1 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.3;
    font-weight: 400;
}

.site-header h1 strong {
    font-weight: 700;
    display: block;
}

.nav-menu ul {
    list-style: none;
    display: flex;
}

.nav-menu li {
    margin-left: 1.5rem;
}

.nav-menu a {
    color: var(--primary-color);
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 4px;
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: var(--primary-color);
    color: var(--secondary-color);
}

/* --- Hamburger Menu (Mobile) --- */
.hamburger {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- Main Content --- */
.main-content {
    padding: 2rem 1rem;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Home Screen Hero Section --- */
.home-hero {
    text-align: center;
    margin: 2rem 0 3rem 0;
    padding: 0;
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.home-logo {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 0 1.5rem 0;
    display: block;
}

.chair-text {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--primary-color);
    margin: 0;
    padding: 0.5rem 1rem;
    font-family: "Libre Baskerville", serif;
}

.election-commitment {
    font-family: "Libre Baskerville", serif !important;
    font-style: italic !important;
    font-size: 1rem;
    color: #FFFFFF !important;
    margin: 2rem auto 2rem auto;
    max-width: 800px;
    line-height: 1.6;
    padding: 0 1rem;
    text-align: center;
}

/* --- Notices Section --- */
.home-notices-section {
    margin-bottom: 3rem;
    padding: 2rem 1rem;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-family: "Libre Baskerville", serif;
    font-weight: 400;
}

.home-page .section-title {
    color: var(--secondary-color);
}

.notices-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.notice-card {
    background-color: var(--secondary-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.notice-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.notice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.notice-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
    flex: 1;
    margin-right: 1rem;
}

.notice-date {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

.notice-content {
    color: var(--text-color);
    line-height: 1.6;
}

.notice-content p {
    margin: 0;
}

/* --- PDF Actions Buttons --- */
.notice-pdf-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    touch-action: manipulation; /* Improve touch responsiveness */
    user-select: none; /* Prevent text selection on tap */
}

.pdf-view-btn {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    border: 2px solid var(--primary-color);
}

.pdf-view-btn:hover,
.pdf-view-btn:active {
    background-color: #003366;
    border-color: #003366;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,31,63,0.3);
}

.pdf-download-btn {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.pdf-download-btn:hover,
.pdf-download-btn:active {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,31,63,0.3);
}

/* Active state for mobile tap feedback */
.pdf-btn:active {
    transform: scale(0.98);
}

.pdf-btn svg {
    flex-shrink: 0;
}

.no-notices {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error-message {
    padding: 1rem;
    text-align: center;
}

.home-page .notice-card {
    background-color: rgba(255, 255, 255, 0.95);
}

/* --- Compact Notice Links for Home Page --- */
.home-notices-section .notices-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.notice-link-home {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.notice-link-home:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

/* --- Shiny Blinking Border for Latest Notice --- */
.notice-link-home.latest-notice {
    position: relative;
    background: linear-gradient(135deg, rgba(220,220,220,0.15), rgba(255,255,255,0.1));
    border: 2px solid;
    border-image: linear-gradient(45deg, #b8860b, #daa520, #b8860b) 1;
    animation: shimmer 2s infinite, borderPulse 1.5s ease-in-out infinite;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.3), 0 0 15px rgba(184, 134, 11, 0.2);
}

.notice-link-home.latest-notice::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #b8860b, #daa520, #c0c0c0, #daa520, #b8860b);
    background-size: 400% 400%;
    border-radius: 4px;
    z-index: -1;
    animation: gradientShift 3s ease infinite;
    opacity: 0.5;
}

.notice-link-home.latest-notice::after {
    content: 'NEW';
    position: absolute;
    top: -12px;
    right: -8px;
    background: linear-gradient(135deg, #b8860b, #daa520);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: badgePulse 1.5s ease-in-out infinite;
}

.notice-link-home.latest-notice:hover {
    background: linear-gradient(135deg, rgba(220,220,220,0.25), rgba(255,255,255,0.15));
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(184, 134, 11, 0.4), 0 0 20px rgba(184, 134, 11, 0.25);
}

@keyframes shimmer {
    0%, 100% {
        box-shadow: 0 0 8px rgba(184, 134, 11, 0.3), 0 0 15px rgba(184, 134, 11, 0.2);
    }
    50% {
        box-shadow: 0 0 12px rgba(184, 134, 11, 0.5), 0 0 20px rgba(184, 134, 11, 0.3), 0 0 25px rgba(184, 134, 11, 0.2);
    }
}

@keyframes borderPulse {
    0%, 100% {
        border-color: #b8860b;
    }
    50% {
        border-color: #daa520;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.home-page .no-notices {
    color: var(--secondary-color);
    text-align: center;
    padding: 1rem;
}

.home-page #home-notices-container > p {
    color: var(--secondary-color);
    text-align: center;
}

/* --- Results Styling --- */
.results-container {
    margin-top: 2rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.results-table th,
.results-table td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
}

.results-table th {
    background-color: var(--primary-color);
    color: var(--header-text);
    font-weight: bold;
    text-transform: uppercase;
}

.results-table th.votes-header,
.results-table td.votes-cell {
    text-align: right;
    font-weight: bold;
    min-width: 100px;
}

.results-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

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

.school-group {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.school-group h3 {
    background-color: #f4f4f4;
    padding: 1rem;
    margin: 0;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

#last-updated {
    font-weight: bold;
}

/* --- Statistics Page Styling --- */
.statistics-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin-top: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background-color: var(--secondary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.stat-card h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.pie-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1rem;
}

.pie-chart {
    width: 220px;
    height: 220px;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

.legend-color {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-color);
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    background-color: #f9f9f9;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    color: #555;
}

/* --- Responsive (Mobile-First) --- */
@media (max-width: 768px) {
    .nav-menu {
        display: none; /* Hide menu by default */
        position: absolute;
        top: 83px; /* Height of header */
        left: 0;
        width: 100%;
        background-color: var(--secondary-color);
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        border-bottom: 3px solid var(--primary-color);
    }
    
    .nav-menu.active {
        display: block; /* Show when active */
    }
    
    .nav-menu ul {
        flex-direction: column;
    }
    
    .nav-menu li {
        margin: 0;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu a {
        display: block;
        padding: 1rem;
        color: var(--primary-color);
    }
    
    .nav-menu a:hover,
    .nav-menu a.active {
        background-color: var(--primary-color);
        color: var(--secondary-color);
    }
    
    .hamburger {
        display: flex; /* Show hamburger icon */
    }

    /* Hamburger "X" animation */
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    .site-header h1 {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    /* Mobile table styling */
    .results-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-table {
        font-size: 0.9rem;
        min-width: 100%;
    }
    
    .results-table th,
    .results-table td {
        padding: 10px 12px;
        font-size: 0.95rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .results-table th.votes-header,
    .results-table td.votes-cell {
        min-width: 80px;
        width: auto;
    }
    
    .results-table td:first-child {
        max-width: 200px;
    }
    
    .school-group h3 {
        font-size: 1rem;
        padding: 0.75rem;
        word-wrap: break-word;
    }
    
    .content-container {
        padding: 0 0.5rem;
    }
    
    .main-content {
        padding: 1rem 0.5rem;
    }
    
    /* Mobile home screen styling */
    .home-hero {
        margin: 1.5rem 0 2rem 0;
        padding: 0;
        width: 100vw;
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
    }
    
    .home-logo {
        width: 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    .chair-text {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .election-commitment {
        font-size: 0.95rem;
        margin-top: 1.2rem;
        color: #FFFFFF !important;
        font-style: italic !important;
    }
    
    .home-page .election-commitment {
        color: #FFFFFF !important;
        font-style: italic !important;
    }
    
    /* Mobile notices styling */
    .home-notices-section {
        margin-bottom: 2rem;
        padding: 1.5rem 0.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .home-notices-section .notices-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .notice-link-home {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
        text-align: center;
    }
    
    /* Mobile adjustments for latest notice effect */
    .notice-link-home.latest-notice::after {
        top: -10px;
        right: -6px;
        font-size: 0.6rem;
        padding: 2px 5px;
    }
    
    .notice-card {
        padding: 1rem;
    }
    
    .notice-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .notice-title {
        font-size: 1.1rem;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .notice-date {
        font-size: 0.85rem;
    }
    
    /* Mobile PDF buttons styling */
    .notice-pdf-actions {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .pdf-btn {
        justify-content: center;
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        width: 100%;
        min-height: 44px; /* Touch-friendly minimum size */
        text-align: center;
    }
    
    .pdf-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* Ensure latest notice badge doesn't overlap with content on mobile */
    .notice-link-home.latest-notice {
        margin-top: 8px;
    }
    
    /* Disable animations on mobile for better performance */
    @media (prefers-reduced-motion: reduce) {
        .notice-link-home.latest-notice,
        .notice-link-home.latest-notice::before,
        .notice-link-home.latest-notice::after {
            animation: none;
        }
        .notice-link-home.latest-notice {
            border: 2px solid #b8860b;
        }
    }
    
    /* Mobile statistics styling */
    .statistics-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .pie-chart {
        width: 180px;
        height: 180px;
    }
    
    .legend-item {
        font-size: 0.9rem;
    }
}

/* --- Extra Small Mobile Screens (< 480px) --- */
@media (max-width: 480px) {
    .site-header h1 {
        font-size: 0.8rem;
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .notice-card {
        padding: 0.75rem;
    }
    
    .notice-title {
        font-size: 1rem;
    }
    
    .notice-date {
        font-size: 0.8rem;
    }
    
    .notice-content {
        font-size: 0.9rem;
    }
    
    .pdf-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
    
    .pdf-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .notice-link-home {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }
    
    .notice-link-home.latest-notice::after {
        font-size: 0.55rem;
        padding: 1px 4px;
    }
}