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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Side Panel Styles */
.side-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.15);
    z-index: 1001;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateX(-100%);
    -ms-transform: translateX(-100%);
    transform: translateX(-100%);
    -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
}

.side-panel.open {
    -webkit-transform: translateX(0);
    -ms-transform: translateX(0);
    transform: translateX(0);
    visibility: visible;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px;
    background: linear-gradient(135deg, #2c5282 0%, #1e3a5f 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.side-panel-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.side-panel-nav {
    padding: 20px 0;
}

.side-panel-nav::before {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
    margin: 0 12px 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    margin: 4px 12px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background-color: #e8f0f8;
    color: #2c5282;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, #e8f0f8 0%, #d4e4f7 100%);
    color: #2c5282;
    box-shadow: 0 2px 4px rgba(44, 82, 130, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #2c5282 0%, #1e3a5f 100%);
    border-radius: 0 4px 4px 0;
}

.nav-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: inherit;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Hamburger Menu */
.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 2px solid #2c5282;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    color: #2c5282;
    font-size: 1.2rem;
}

.hamburger:hover {
    background-color: #2c5282;
    color: white;
    transform: scale(1.05);
}

.hamburger:active {
    transform: scale(0.95);
}

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

header {
    margin-bottom: 40px;
    padding: 30px 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-title {
    text-align: center;
    flex: 1;
}

header h1 {
    color: #2c5282;
    margin-bottom: 10px;
    font-size: 2em;
}

header p {
    color: #666;
    font-size: 1.1em;
}

.lang-toggle {
    padding: 10px 20px;
    background-color: #2c5282;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.lang-toggle:hover {
    background-color: #1e3a5f;
}

.search-section {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.autocomplete-wrapper {
    flex: 1;
    position: relative;
}

#locationInput {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.3s;
}

#locationInput:focus {
    border-color: #2c5282;
}

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

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: #f0f4f8;
}

.autocomplete-item.active {
    background-color: #e8f0f8;
}

.autocomplete-loading {
    padding: 12px 16px;
    color: #666;
    font-style: italic;
    text-align: center;
}

.autocomplete-no-results {
    padding: 12px 16px;
    color: #999;
    text-align: center;
}

#searchBtn {
    padding: 12px 32px;
    background-color: #2c5282;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#searchBtn:hover {
    background-color: #1e3a5f;
}

#searchBtn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.error {
    display: none;
    padding: 12px;
    background-color: #fee;
    color: #c33;
    border-radius: 6px;
    margin-top: 10px;
}

.error.show {
    display: block;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #2c5282;
    font-weight: 500;
}

.loading.show {
    display: block;
}

.results {
    display: none;
}

.results.show {
    display: block;
}

.search-location {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 15px;
}

.search-location strong {
    color: #2c5282;
    display: inline-block;
    margin-right: 8px;
}

table {
    width: 100%;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

thead {
    background-color: #2c5282;
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Group name column with map icon (first column) */
td:nth-child(1) {
    min-width: 150px;
}

.phone-link {
    color: #2c5282;
    text-decoration: none;
    font-weight: 500;
}

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

.distance {
    color: #666;
    font-weight: 500;
}

.location-link {
    text-decoration: none;
    margin-right: 5px;
    font-size: 1.2em;
    vertical-align: middle;
    transition: transform 0.2s;
    display: inline-block;
}

.location-link:hover {
    transform: scale(1.2);
}

/* Expand/collapse for mobile rows */
.expand-toggle-vs {
    display: none;
    background: none;
    border: none;
    color: #2c5282;
    cursor: pointer;
    font-size: 0.9em;
    padding: 2px 6px;
    vertical-align: middle;
}

.expand-row-vs {
    display: none;
}

.expand-row-vs.expanded {
    display: table-row;
}

.expand-row-vs td {
    padding: 10px 15px;
    background: #f0f4f8;
    border-bottom: 2px solid #e0e0e0;
}

.expand-detail-vs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.expand-detail-vs .detail-item {
    font-size: 13px;
}

.expand-detail-vs .detail-item .label {
    font-weight: 600;
    color: #555;
}

/* Show/Hide for mobile/desktop */
.mobile-only {
    display: none;
}

.desktop-only {
    display: inline;
}

.no-results {
    display: none;
    text-align: center;
    padding: 40px;
    background-color: #fff;
    border-radius: 8px;
    color: #666;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.no-results.show {
    display: block;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header-content {
        gap: 10px;
    }

    .header-title {
        text-align: left;
    }

    header h1 {
        font-size: 1.2em;
    }

    header p {
        font-size: 0.9em;
    }

    .lang-toggle {
        padding: 8px 12px;
        font-size: 12px;
    }

    .hamburger {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .search-section {
        padding: 15px;
    }

    .search-location {
        padding: 12px 15px;
        font-size: 14px;
    }

    .search-box {
        flex-direction: column;
    }

    table {
        font-size: 13px;
    }

    thead {
        font-size: 12px;
    }

    th, td {
        padding: 10px 6px;
    }

    /* On mobile: Hide less critical columns */
    /* Hide: Meeting Location (4), Meeting Days (6) */
    /* Keep: Group Name (1), Volunteer Name (2), Phone (3), Meeting Time (5), Distance (7) */
    th:nth-child(4),
    td:nth-child(4),
    th:nth-child(6),
    td:nth-child(6) {
        display: none;
    }

    .expand-toggle-vs {
        display: inline-block;
    }

    /* Make location link more prominent on mobile */
    .location-link {
        font-size: 1.4em;
        margin-right: 3px;
    }

    /* Adjust phone links for mobile */
    .phone-link {
        font-size: 13px;
        word-break: break-all;
    }

    /* Make table scrollable horizontally if needed */
    .results {
        overflow-x: auto;
    }

    #resultsTable {
        min-width: 100%;
    }

    /* Show mobile-specific content */
    .mobile-only {
        display: inline;
    }

    .desktop-only {
        display: none;
    }

    /* Better spacing for table cells on mobile */
    td {
        vertical-align: top;
    }

    /* Improve readability of group names on mobile */
    td:nth-child(1) {
        font-weight: 500;
        line-height: 1.4;
    }

    /* Ensure distance column is readable */
    td:nth-child(7) {
        white-space: nowrap;
        font-weight: 600;
    }

    /* Better row spacing on mobile */
    tbody tr {
        border-bottom: 2px solid #f0f0f0;
    }

    /* Improve header readability */
    th {
        font-size: 11px;
        padding: 10px 6px;
        line-height: 1.2;
    }

    /* Make side panel wider on mobile */
    .side-panel {
        width: 85%;
        max-width: 300px;
    }

    .nav-item {
        font-size: 14px;
        padding: 12px 16px;
        margin: 4px 8px;
    }

    .side-panel-header h2 {
        font-size: 1.2rem;
    }
}
