/* SA Election 2026 - Main Styles */
/* Adapted from Beyond Two Parties federal site */

:root {
    /* SA-themed colors */
    --primary-color: #6a4c93;      /* Purple - independents */
    --secondary-color: #f9c74f;    /* Gold - highlights */
    --accent-color: #43aa8b;       /* Teal - accent */
    --labor-color: #E31837;        /* Labor red */
    --liberal-color: #0047AB;      /* Liberal blue */
    --greens-color: #10B981;       /* Greens green */
    --independent-color: #8B5CF6;  /* Purple for independents */
    --dark-bg: #1e293b;
    --light-bg: #f8fafc;
    --text-color: #334155;
    --light-text: #f8fafc;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === HEADER === */
header {
    background-color: var(--primary-color);
    padding: 1rem 0;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sa-badge {
    background-color: var(--secondary-color);
    color: var(--dark-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

/* Hamburger menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.hamburger-menu span {
    width: 25px;
    height: 3px;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s;
}

/* === HERO SECTION === */
.hero {
    background: linear-gradient(135deg, var(--dark-bg) 0%, #374151 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.election-badge {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--dark-bg);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--dark-bg);
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(249, 199, 79, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(249, 199, 79, 0.4);
}

/* === STATS BAR === */
.stats-bar {
    background-color: var(--accent-color);
    color: white;
    padding: 1.5rem 0;
}

.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-box {
    text-align: center;
    padding: 0.5rem 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* === SECTIONS === */
.section {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

/* === SEARCH FORM === */
.search-container {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
}

.search-input,
.search-select {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input:focus,
.search-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 76, 147, 0.1);
}

.input-hint {
    font-size: 0.85rem;
    color: #94a3b8;
}

.search-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.search-button:hover {
    background-color: #5a3d80;
    transform: translateY(-2px);
}

/* === SEARCH RESULTS === */
.search-results {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.result-card {
    background: var(--light-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.result-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-district {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.result-member {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.member-info h4 {
    margin-bottom: 0.25rem;
}

.party-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.party-labor { background-color: var(--labor-color); color: white; }
.party-liberal { background-color: var(--liberal-color); color: white; }
.party-greens { background-color: var(--greens-color); color: white; }
.party-independent { background-color: var(--independent-color); color: white; }
.party-other { background-color: #6b7280; color: white; }
.party-vacant { background-color: #9ca3af; color: white; }

.independent-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--independent-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* === MAP SECTION === */
.map-section {
    background-color: var(--light-bg);
}

/* Map controls */
.map-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.map-control-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.map-control-btn:hover {
    background-color: #5a3d80;
    transform: translateY(-2px);
}

/* Map container */
#electoral-map-container {
    width: 100%;
    height: 500px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    background: #e2e8f0;
}

/* Map loading state */
.map-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 16px;
}

.map-loader-content {
    text-align: center;
}

.map-loader-content p {
    margin-top: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Map error state */
.map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.map-error button {
    margin-top: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
}

/* Map popup styling */
.map-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-width: 180px;
}

.map-popup h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.map-popup .popup-member {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.map-popup .popup-party {
    margin: 0.5rem 0;
}

.map-popup .popup-party-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.map-popup .popup-party-badge.party-labor { background-color: var(--labor-color); }
.map-popup .popup-party-badge.party-liberal { background-color: var(--liberal-color); }
.map-popup .popup-party-badge.party-greens { background-color: var(--greens-color); }
.map-popup .popup-party-badge.party-independent { background-color: var(--independent-color); }
.map-popup .popup-party-badge.party-vacant { background-color: #808080; }
.map-popup .popup-party-badge.party-other { background-color: #6B7280; }

.map-popup .popup-link {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.map-popup .popup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.map-popup .popup-link a:hover {
    text-decoration: underline;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-tip {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* === VOTING INFO SECTION === */
.voting-info {
    background: white;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.info-card {
    background: var(--light-bg);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.info-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.info-highlight {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #fbbf24 100%);
    color: var(--dark-bg);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.info-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.info-link:hover {
    text-decoration: underline;
}

/* === INDEPENDENTS SPOTLIGHT === */
.independents-spotlight {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.spotlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.spotlight-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.spotlight-card h3 {
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.spotlight-district {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.spotlight-card.highlight {
    border: 2px solid var(--independent-color);
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

/* === KEY DATES === */
.key-dates {
    background: var(--dark-bg);
    color: white;
}

.key-dates .section-title,
.key-dates .section-subtitle {
    color: white;
}

.dates-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.date-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    text-align: center;
    min-width: 120px;
}

.date-card.featured {
    background: var(--secondary-color);
    color: var(--dark-bg);
}

.date-day {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.date-month {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.date-label {
    font-size: 0.85rem;
    opacity: 0.8;
}

.date-card.featured .date-label {
    opacity: 1;
    font-weight: 600;
}

/* === FOOTER === */
footer {
    background-color: #0f172a;
    color: white;
    padding: 3rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-column p {
    color: #94a3b8;
    line-height: 1.7;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 2rem;
    text-align: center;
}

.disclaimer {
    font-size: 0.85rem;
    color: #64748b;
    max-width: 800px;
    margin: 0 auto 1rem;
}

/* === CANDIDATE ALTERNATIVES === */
.candidate-alternatives {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.alternatives-header-box h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.candidate-list,
.lc-candidate-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.candidate-card {
    background: var(--light-bg);
    border-radius: 10px;
    padding: 1.25rem;
    border-left: 4px solid var(--independent-color);
}

.candidate-card .candidate-info h4 {
    margin-bottom: 0.4rem;
}

.party-website-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.party-website-link:hover {
    text-decoration: underline;
}

.candidate-placeholder {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    padding: 1.5rem;
    grid-column: 1 / -1;
}

.candidate-placeholder p {
    margin-bottom: 0.5rem;
    color: #78350f;
}

.candidate-placeholder p:last-child {
    margin-bottom: 0;
}

.candidate-placeholder a {
    color: var(--primary-color);
    font-weight: 600;
}

.upper-house-alternatives {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.upper-house-alternatives h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.upper-house-note {
    color: #64748b;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* Breadcrumb */
.breadcrumb {
    background: var(--light-bg);
    padding: 0.75rem 0;
    font-size: 0.9rem;
    color: #64748b;
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

/* === LOADING STATES === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === ERROR STATES === */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hero h1 {
        font-size: 2.5rem;
    }

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

    .stats-container {
        gap: 0.5rem;
    }

    .stat-box {
        flex: 1 1 45%;
    }

    .stat-number {
        font-size: 2rem;
    }

    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .search-container {
        padding: 1.5rem;
    }

    .dates-grid {
        gap: 1rem;
    }

    .date-card {
        padding: 1rem;
        min-width: 100px;
    }

    .date-day {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        width: 95%;
        padding: 0 10px;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .cta-button {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }

    .stat-box {
        flex: 1 1 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}
