/* ============================================================
   ELECTION HUB — Global Stylesheet
   ============================================================ */

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'DM Sans', Arial, sans-serif;
    background: #f7f4ef;
    color: #0d1f3c;
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

/* Shared animation used by header dropdown + modals */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Utility ── */
.mobile-only  { display: none; }
.desktop-only { display: inline-block; }

@media (max-width: 768px) {
    .desktop-only { display: none; }
    .mobile-only  { display: block; }
}

/* ============================================================
   CANVASSING APP — Map Layout
   ============================================================ */

.map-container {
    width: 100%;
    height: calc(100vh - 64px);
    position: fixed;
    top: 64px;
    left: 0;
    overflow: hidden;
}

.map-container #map,
#map {
    width: 100%;
    height: 100%;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 64px;
    right: 0;
    width: 300px;
    height: calc(100vh - 64px);
    background: #ffffff;
    padding: 15px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: -2px 0 12px rgba(13,31,60,0.12);
    border-left: 1px solid #dde3ed;
}

.sidebar.open { display: block; }

.sidebar h3 {
    margin-top: 0;
    font-family: 'Playfair Display', serif;
    color: #0d1f3c;
}

.sidebar strong { display: block; margin: 5px 0; }

.close-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7a92;
    font-weight: bold;
}

.close-btn:hover { color: #0d1f3c; }

/* ── Sidebar Toggle ── */
.toggle-sidebar-btn {
    position: fixed;
    top: 74px;
    left: 10px;
    background: linear-gradient(135deg, #0d1f3c, #1e3f6f);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1001;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    box-shadow: 0 3px 10px rgba(13,31,60,0.2);
}

/* ── Batch Select Modal ── */
#batchModal {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(13,31,60,0.55);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(13,31,60,0.22);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #c9952a, #e8b84b);
    border-radius: 12px 12px 0 0;
}

#batchNumber {
    width: 80%;
    max-width: 400px;
    text-align: center;
    margin-bottom: 20px;
    padding: 11px 14px;
    font-size: 1rem;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    color: #0d1f3c;
    background: #f7f4ef;
    outline: none;
}

#batchNumber:focus {
    border-color: #c9952a;
    box-shadow: 0 0 0 3px rgba(201,149,42,0.12);
    background: #ffffff;
}

.submit-btn {
    padding: 12px 32px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #0d1f3c 0%, #1e3f6f 100%);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 100px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(13,31,60,0.2);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(13,31,60,0.28);
}

/* ── Voter List Modal (mobile, canvassing) ── */
#voterListModal {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 64px);
    background: white;
    padding: 20px;
    z-index: 2000;
    box-sizing: border-box;
    overflow: auto;
}

#voterListModal h2 {
    position: sticky;
    top: 0;
    background: white;
    padding: 15px;
    font-size: 1.1rem;
    text-align: center;
    border-bottom: 2px solid #dde3ed;
    z-index: 10;
    font-family: 'Playfair Display', serif;
    color: #0d1f3c;
    margin: 0 0 10px;
}

#voterListModal ul {
    padding: 10px;
    list-style: none;
    margin: 0;
}

/* ── Route Modal ── */
.routeModal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(13,31,60,0.18);
    border: 1px solid #dde3ed;
}

.routeModal-content { text-align: center; }
.close { float: right; cursor: pointer; }

/* ── Route Sidebar ── */
#route-sidebar {
    display: none;
    position: fixed;
    top: 64px;
    right: 0;
    width: 300px;
    height: calc(100vh - 64px);
    background: white;
    box-shadow: -2px 0 10px rgba(13,31,60,0.12);
    overflow-y: scroll;
    border-left: 1px solid #dde3ed;
}

#route-sidebar.open { display: block; }

/* ── Voter Search ── */
.voter-search-control { background: transparent; border: none; }
.search-wrapper { width: 250px; }

#voterSearchInput {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1.5px solid #dde3ed;
    box-shadow: 0 2px 8px rgba(13,31,60,0.08);
    font-size: 14px;
    outline: none;
    font-family: 'DM Sans', sans-serif;
    background: white;
    color: #0d1f3c;
}

#voterSearchInput:focus {
    border-color: #c9952a;
    box-shadow: 0 0 0 3px rgba(201,149,42,0.12);
}

#voterSearchResults {
    background: white;
    margin-top: 5px;
    border-radius: 8px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 6px 18px rgba(13,31,60,0.14);
    border: 1px solid #dde3ed;
}

.search-item {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.search-item:hover { background: #f7f4ef; }
.search-name { font-weight: 600; color: #0d1f3c; }
.search-address { font-size: 12px; color: #6b7a92; }

/* ── Map Overlay Controls ── */
.map-overlay-controls {
    position: absolute;
    top: 80px;
    left: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-overlay-controls button {
    background: linear-gradient(135deg, #0d1f3c, #1e3f6f);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(13,31,60,0.2);
    transition: transform 0.15s ease;
}

.map-overlay-controls button:hover { transform: translateY(-1px); }

/* ── Location / Route Buttons ── */
.location-btn {
    position: relative;
    background: linear-gradient(135deg, #0d1f3c, #1e3f6f);
    color: white;
    border: none;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.location-btn .btn-text { display: none; margin-left: 8px; }
.location-btn:hover .btn-text { display: inline; }

/* ── Geocoder Inputs ── */
input[type="text"] {
    padding: 10px;
    font-size: 14px;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    outline: none;
    margin-bottom: 10px;
    background: white;
    color: #0d1f3c;
    font-family: 'DM Sans', sans-serif;
}

.startLocation, .endLocation {
    padding: 10px;
    font-size: 14px;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    outline: none;
    background: white;
    color: #0d1f3c;
    font-family: 'DM Sans', sans-serif;
}

.startLocation:focus, .endLocation:focus {
    border-color: #c9952a;
    box-shadow: 0 0 0 3px rgba(201,149,42,0.12);
}

.suggestions-list {
    position: absolute;
    background: white;
    width: 250px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(13,31,60,0.12);
    border: 1px solid #dde3ed;
}

.suggestion-item { padding: 10px; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.suggestion-item:hover { background: #f7f4ef; }

/* ── Mobile Responsive for Map Pages ── */
@media (max-width: 768px) {
    .map-container { top: 56px; height: calc(100vh - 56px); }
    .sidebar { width: 85%; max-width: 320px; }
    #voterListModal { top: 56px; height: calc(100vh - 56px); }
    #batchNumber { font-size: 1rem; width: 90%; }
}

@media (max-width: 480px) {
    .modal-content { width: 92vw; padding: 20px; }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 64px;
    background: linear-gradient(135deg, #0d1f3c 0%, #1e3f6f 100%);
    border-bottom: 1px solid rgba(201,149,42,0.2);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 2px 16px rgba(13,31,60,0.18);
}

/* LEFT */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logoheader { height: 32px; }

.title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.01em;
}

/* NAV */
.nav-links { display: flex; gap: 4px; }

.nav-item {
    text-decoration: none;
    color: rgba(255,255,255,0.78);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 100px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-item:hover {
    color: #e8b84b;
    background: rgba(201,149,42,0.12);
}

.nav-item.active {
    color: #e8b84b;
    background: rgba(201,149,42,0.14);
}

/* USER MENU */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.username {
    color: #ffffff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* PROFILE */
.profile-img {
    height: 36px;
    width: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(201,149,42,0.55);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    object-fit: cover;
}

.profile-img:hover {
    border-color: #e8b84b;
    box-shadow: 0 0 0 3px rgba(201,149,42,0.2);
}

/* DROPDOWN */
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #ffffff;
    border: 1px solid #dde3ed;
    border-radius: 12px;
    min-width: 210px;
    padding: 8px 0;
    box-shadow: 0 8px 32px rgba(13,31,60,0.16);
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
    animation: fadeUp 0.18s ease both;
}

.dropdown-username {
    padding: 10px 18px 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #6b7a92;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: none;
}

/* ITEMS */
.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 18px;
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    color: #0d1f3c;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

.dropdown-item:hover { background: #f7f4ef; color: #1e3f6f; }

.dropdown-divider { height: 1px; background: #dde3ed; margin: 6px 0; }

.logout-item { color: #b92b2b; }
.logout-item:hover { background: #fdf0f0; color: #b92b2b; }
.dropdown-form { margin: 0; }

/* LOGIN */
.login-btn {
    text-decoration: none;
    padding: 8px 22px;
    background: linear-gradient(135deg, #c9952a 0%, #e8b84b 100%);
    color: #0d1f3c;
    border-radius: 100px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 10px rgba(201,149,42,0.3);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(201,149,42,0.42);
}

/* MOBILE MENU TOGGLE */
.menu-toggle {
    display: none;
    font-size: 22px;
    cursor: pointer;
    color: #ffffff;
    background: none;
    border: none;
    padding: 4px 8px;
    line-height: 1;
}

/* RESPONSIVE HEADER */
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .header {
        height: auto;
        padding: 12px 20px;
        align-items: flex-start;
        gap: 0;
    }

    .header-left { flex: 1; }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 8px;
        gap: 2px;
        padding-bottom: 8px;
        order: 10;
    }

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

    .nav-item { padding: 10px 14px; border-radius: 8px; }

    .desktop-only { display: none !important; }

    .mobile-only { display: block; }

    .dropdown-username { display: block; }

    .user-menu { margin-top: 2px; }
}
