/* ==============================
   Reset and Base Styles
   ============================== */

/* Reset some default browser styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Base Styling */
body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f4f8; /* Retained from older version for better background */
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* Smooth Scroll for Internal Links */
html {
    scroll-behavior: smooth;
}

/* ==============================
   Header and Navigation
   ============================== */

/* Alert banner */
.alert-banner {
    background-color: #d9edf7;
    color: #31708f;
    margin-bottom: 20px;
    border: 1px solid #bce8f1;
    border-radius: 4px;
}

.alert-banner p {
    margin: 1em 0;
	padding-left:25px;
	padding-right: 25px;
}

.alert-banner a {
    color: #31708f;
    font-weight: bold;
	text-decoration: none;
}

.alert-banner a:hover,
.alert-banner a:focus {
    color: #245269;
}

/* COS Bar */
.cos-bar {
    background-color: #fff;
    border-bottom: 2px solid #4CAF50;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.cos-bar .logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-left: 20px;
}

.cos-bar .logo img {
    width: 304px;
    height: auto;
    max-width: 100%;
}

.cos-bar .separator {
    width: 1px;
    height: 48px; /* Adjusted to 60% of 80px */
    background-color: #525252;
    margin: 0 40px;
}

.cos-bar .logo a.mayor-link {
    text-decoration: none;
}

.cos-bar .mayor-name {
    position: relative;
    top: -5px; /* Shift up by 5px */
    font-family: 'proxima-nova', Arial, sans-serif;
    font-size: 24px;
    color: #525252;
    font-weight: 200;
    margin-left: 10px;
}

/* Header Styling with Responsive Background Image */
.header {
    width: 100%;
    background-image: url('banner-vote-stickers.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    padding: 40px 20px; /* Adjusted padding */
    text-align: center;
    position: relative;
    margin-top: 0; /* Remove any top margin */
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(128, 128, 128, 0.5); /* Translucent gray overlay */
    z-index: 1;
}

.header h1,
.header p,
.header .search-container {
    position: relative;
    z-index: 2; /* Above the overlay */
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header p {
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0.5rem auto 0;
    padding: 0 10px;
}

.header .search-container {
    position: relative;
    margin-top: 20px; /* Adjust as needed */
}

/* ==============================
   Main Content
   ============================== */

/* Container for Main Content */
.container {
    flex: 1;
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
}

/* Search Container */
.search-container {
    position: relative;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Search Box */
#search-box {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.125rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

#search-box:focus {
    border-color: #4a90e2;
    outline: none;
}

/* Autocomplete Suggestions */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 2px solid #4a90e2;
    border-top: none;
    background-color: #fff;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

.autocomplete-suggestions.active {
    display: block;
}

.autocomplete-helper {
    padding: 12px 20px;
    background-color: #f9f9f9;
    color: #333;
    font-style: italic;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.autocomplete-helper a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
    margin-left: 10px;
}

.autocomplete-helper a:hover,
.autocomplete-helper a:focus {
    text-decoration: underline;
}

.autocomplete-suggestion {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #333;
    text-align: left;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion:focus {
    background-color: #f1f1f1;
}

.autocomplete-suggestion.no-result {
    font-weight: bold;
    background-color: #fafafa;
}

.autocomplete-suggestion.no-result:hover,
.autocomplete-suggestion.no-result:focus {
    background-color: #e0e0e0;
}

#buttons-section {
    max-width: 800px;
    margin: 20px auto;
}

#accessibility-content {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

#translations-content {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Result Display */
.result-display {
    background-color: #fff;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    margin-top: 20px;
}

.result-item {
    margin-bottom: 15px;
}

.result-item strong {
    display: inline-block;
    width: 140px;
    color: #555;
}

/* Sections */
.polling-place, 
.statewideOfficials, 
.districtRepresentatives, 
.stateRepresentative, 
.all-ward-councilors, 
.officials-list {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.polling-place h5,
.statewideOfficials h5,
.districtRepresentatives h5,
.stateRepresentative h5,
.all-ward-councilors h3,
.officials-list h3 {
    margin-bottom: 10px;
    color: #4a90e2;
    font-weight: 700;
    font-size: 1.125rem;
}

.polling-place p,
.statewideOfficials p,
.districtRepresentatives p,
.stateRepresentative p,
.all-ward-councilors p,
.officials-list p {
    margin-bottom: 15px;
    color: #666;
    font-size: 1rem;
}

/* ==============================
   Buttons
   ============================== */

/* Existing Blue Buttons Container */
.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

/* Buttons Heading */
.buttons h4 {
    width: 100%;
    margin-bottom: 10px; /* Adds space between the heading and buttons */
    text-align: center;   /* Centers the heading */
    font-weight: bold;
}

/* Individual Existing Blue Buttons */
.buttons a {
    flex: 1 1 calc(50% - 15px);
    text-align: center;
    padding: 12px 20px;
    font-size: 1rem;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
    background-color: #4a90e2; /* Existing blue color */
    min-width: 120px;
}

.buttons a:hover, 
.buttons a:focus {
    background-color: #357ab8;
    transform: translateY(-2px);
}

/* Remove Chevron from Existing Blue Buttons */
.buttons a .chevron {
    display: none;
}

/* Access Buttons Container for Accessibility and Translations */
.buttons-access {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
	max―width: 800px;
	margin-left: auto;
	margin-right: auto;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

/* Access Buttons Heading */
.buttons-access h4 {
    width: 100%;
    margin-bottom: 10px; /* Adds space between the heading and buttons */
    text-align: center;   /* Centers the heading */
    font-weight: bold;
    color: #558F4F;       /* Text color as specified */
}

/* Individual Access Buttons */
.buttons-access a {
    flex: 1 1 calc(50% - 15px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 20px;
    font-size: 1rem;
    color: #558F4F; /* Text color as specified */
    background-color: #fff; /* Background color as specified */
    border: 1px solid #558F4F; /* Thin border as specified */
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
    min-width: 120px;
    position: relative;
}

.buttons-access a:hover, 
.buttons-access a:focus {
    background-color: #e4eee3; /* Slight background change on hover for better UX */
    transform: translateY(-2px);
    border-color: #558F4F;
}

/* Chevron Icon within Access Buttons */
.buttons-access a::after {
    content: "\25B6"; /* Right-pointing triangle */
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    color: #558F4F; /* Chevron color as specified */
}

.buttons-access a[aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(90deg);
}

.buttons-access a.active .chevron {
    transform: rotate(180deg);
}

/* Icon Images within Access Buttons */
.buttons-access a img {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    fill: #558F4F; /* Ensure SVG icons inherit text color if applicable */
}

/* ==============================
   Accordion
   ============================== */

.accordion {
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
}

.accordion-header {
    cursor: pointer;
    padding: 10px 15px 10px 15px;
    background-color: #f7f7f7;
    font-weight: bold;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-right: 40px; /* Ensures space for the chevron */
}

.accordion-header::after {
    content: '\25B6'; /* Right-pointing triangle */
    font-size: 0.8rem;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s;
}

.accordion-header.active::after {
    content: '\25BC'; /* Down-pointing triangle */
    transform: translateY(-50%) rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 10px 15px;
    background-color: #fff;
}

.accordion-content a {
    white-space: normal;        /* Allows text to wrap */
    word-break: break-word;     /* Breaks long words to prevent overflow */
    overflow-wrap: break-word;  /* Ensures words break to prevent overflow */
    word-wrap: break-word;      /* Legacy property for word breaking */
    max-width: 100%;            /* Ensures the link doesn't exceed its container's width */
    display: inline-block;      /* Allows the link to respect width and wrapping */
}

.accordion-content p {
    margin-bottom: 8px;
}

/* Expanded Accordion Section for Access Buttons */
.accordion-content.access-section {
    background-color: #e4eee3;
    width: 100%;
}

/* ==============================
   Error Message
   ============================== */

/* Error Message */
.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 20px;
    font-size: 1.125rem;
    display: none; /* Ensure it's hidden by default */
}

/* ==============================
   Footer
   ============================== */

footer {
    background-color: #333;
    color: #fff;
    padding: 20px 0;
    text-align: center;
}

footer p {
    margin: 0;
    font-size: 1rem;
}

/* ==============================
   Language Dropdown
   ============================== */

.language-dropdown {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin: 20px auto;
    max-width: 325px;
}

a.button-primary {
    background-color: #e4eee3;
    border: none;
    border-radius: 4px;
    box-sizing: border-box;
    color: #558f4f;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 24px;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s ease-out 0s;
    text-decoration: none;
    padding: 12px;
    width: 325px;
}

.chevron {
    transition: transform 0.2s ease;
}

.rotate-down {
    transform: rotate(90deg);
}

.language-dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    width: 100%;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    top: calc(100% + 5px);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.language-dropdown-content a {
    color: #297ba7;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s ease-out 0s;
}

.language-dropdown-content a:hover {
    background-color: #ddd;
}

/* ==============================
   Translation Loader
   ============================== */
   
#translation-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 8px;
    z-index: 1002;
    display: none;
}

/* ==============================
   Animations
   ============================== */

/* Fade-in Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==============================
   Media Queries
   ============================== */

/* Responsive Design for Tablets */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    #search-box {
        font-size: 1rem;
        padding: 12px 15px;
    }

    .result-item strong {
        width: 120px;
    }

    /* Existing Blue Buttons */
    .buttons a {
        font-size: 0.95rem;
        padding: 10px 15px;
        min-width: 100px;
        flex: 1 1 100%; /* Stack buttons in a single column */
    }

    /* Access Buttons */
    .buttons-access a {
        flex: 1 1 100%; /* Stack buttons in a single column */
    }

    .polling-place h5,
    .statewideOfficials h5,
    .districtRepresentatives h5,
    .stateRepresentative h5,
    .all-ward-councilors h3,
    .officials-list h3 {
        font-size: 1rem;
    }

    .polling-place p,
    .statewideOfficials p,
    .districtRepresentatives p,
    .stateRepresentative p,
    .all-ward-councilors p,
    .officials-list p {
        font-size: 0.95rem;
    }
    
    /* Adjust COS Bar Layout for Tablet */
    .cos-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
    }

    .cos-bar .logo {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
    }

    .cos-bar .mayor-name {
        margin-left: 0;
        margin-top: 10px;
        font-size: 20px;
        text-align: left;
    }

    .cos-bar .separator {
        display: none;
    }

    /* Adjust Accordion Header for Tablet */
    .accordion-header {
        padding-right: 40px; /* Ensure padding for chevron */
    }

    /* Access Buttons Heading Color */
    .buttons-access h4 {
        color: #558F4F;
    }
}

/* Responsive Design for Mobile Phones */
@media (max-width: 480px) {
    .header {
        padding: 40px 15px;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .header p {
        font-size: 1rem;
    }

    #search-box {
        font-size: 1rem;
        padding: 10px 15px;
    }

    /* Existing Blue Buttons */
    .buttons a {
        font-size: 0.9rem;
        padding: 10px 12px;
        min-width: 100%;
        flex: 1 1 100%; /* Ensure buttons are full width */
    }

    /* Access Buttons */
    .buttons-access a {
        flex: 1 1 100%; /* Ensure buttons are full width */
    }

    .result-item strong {
        width: 100px;
    }
    
    /* Further Adjust COS Bar Layout for Mobile */
    .cos-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 10px;
    }

    .cos-bar .logo {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
    }

    .cos-bar .mayor-name {
        margin-left: 0;
        margin-top: 8px;
        font-size: 18px;
        text-align: left;
    }

    .cos-bar .separator {
        display: none;
    }

    .cos-bar .logo img {
        width: 200px;
        height: auto;
    }

    /* Accordion Header Adjustments for Mobile */
    .accordion-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        width: 100%;
        flex-wrap: wrap;
        padding-right: 40px; /* Ensure padding for chevron */
    }

    .accordion-header::after {
        margin-left: 10px;
    }

    /* Ensure Accordion Titles Wrap Properly */
    .accordion-header span {
        flex: 1 1 auto;
        margin-right: 10px;
        word-wrap: break-word;
    }

    /* Access Buttons Heading Color */
    .buttons-access h4 {
        color: #558F4F;
    }
}