/* Reset and Base Styles */
*, :after, :before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -o-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    background: #f8f9fa;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: #2c3e50;
    font-weight: 400;
    margin: 0;
    overflow: hidden;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    color: #2980b9;
}

[hidden] {
    display: none;
}

/* Map Container */
#map {
    position: fixed !important;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow: visible !important;
    z-index: 1;
}

/* Modern Menu System */
#modern-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 380px;
    max-height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#modern-menu.menu-collapsed {
    width: 60px;
    height: 60px;
    overflow: hidden;
}

#modern-menu.menu-collapsed .menu-content {
    display: none;
}

#modern-menu.menu-collapsed .menu-header {
    padding: 10px;
    /* border-radius: 50%; */
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modern-menu.menu-collapsed .menu-header h2 {
    display: none;
}

#modern-menu.menu-open {
    width: 380px;
    height: auto;
    max-height: calc(100vh - 40px);
}

#modern-menu.menu-open .menu-content {
    display: block;
}

#modern-menu.menu-open .menu-header {
    padding: 20px;
    border-radius: 20px 20px 0 0;
    width: auto;
    height: auto;
    display: flex;
    justify-content: space-between;
}

#modern-menu.menu-open .menu-header h2 {
    display: block;
}

.menu-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.menu-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    margin: 4px 0;
    transition: 0.3s;
}

.menu-content {
    padding: 20px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

/* Search Section */
.search-section {
    margin-bottom: 25px;
}

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

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-box button {
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.search-box button:hover {
    background: #5a6fd8;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    transition: opacity 0.2s ease;
}

.search-result-item {
    padding: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.church-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.church-deanery {
    font-size: 12px;
    color: #7f8c8d;
}

.no-results {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
}

/* Quick Access */
.quick-access {
    margin-bottom: 25px;
}

.quick-access h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2c3e50;
}

.quick-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-btn {
    padding: 10px 16px;
    background: #ecf0f1;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #2c3e50;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: #d5dbdb;
    transform: translateY(-1px);
}

/* Diocese Filter */
.diocese-filter {
    margin-bottom: 25px;
}

.diocese-filter h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2c3e50;
}

.diocese-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.diocese-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.diocese-item:hover {
    background: #f8f9fa;
}

.diocese-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.diocese-item input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.diocese-item input[type="checkbox"]:checked + .checkmark:after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.diocese-name {
    flex: 1;
    font-size: 14px;
    color: #2c3e50;
}

.church-count {
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Advanced Filters */
.advanced-filters {
    margin-bottom: 25px;
}

.advanced-filters h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2c3e50;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.year-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.year-input:focus {
    outline: none;
    border-color: #667eea;
}

.panorama-options {
    display: flex;
    gap: 10px;
}

.panorama-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.panorama-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.panorama-option input[type="checkbox"] {
    display: none;
}

.panorama-option input[type="checkbox"]:checked + .checkmark + span {
    color: #667eea;
    font-weight: 600;
}

.panorama-option input[type="checkbox"]:checked {
    background: #667eea;
}

.panorama-option.checked {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.panorama-option .checkmark {
    width: 16px;
    height: 16px;
}

.panorama-option span {
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

/* Apply Filters Button */
.apply-filters-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.apply-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

/* Location Focus Button */
#focus {
    width: 50px;
    height: 50px;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 20;
    cursor: pointer;
    background: white;
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

#focus:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* Popup Styles */
.popup {
    width: 500px;
    max-width: 100%;
    background: white;
    padding-left: 60px;
    border-radius: 15px;
    padding-bottom: 20px;
    z-index: 10;
    font-size: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.popup .img {
    position: absolute;
    left: -35px;
    top: -35px;
    border: 10px solid white;
    border-radius: 100%;
    overflow: hidden;
    width: 120px;
    height: 120px;
    z-index: 15;
    background-color: white;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.popup .deanery {
    margin: 15px 0 0;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    color: #667eea;
}

.popup .title {
    font-size: 24px;
    text-align: center;
    margin: 10px 10px 10px 5px;
    font-weight: 600;
    position: relative;
    z-index: 1;
    color: #2c3e50;
}

.popup .container {
    padding: 10px 0;
}

.popup .age, .popup .style, .popup .material, .popup .d3 {
    margin: 8px 0;
    padding: 8px 0;
}

.popup .age span, .popup .style span, .popup .material span, .popup .d3 span {
    text-transform: capitalize;
    color: #7f8c8d;
}

.popup hr {
    border: none;
    height: 1px;
    background: #ecf0f1;
    margin: 15px 0;
}

.popup .worktime .main {
    margin-top: 10px;
    color: #2c3e50;
}

.popup .media .deanery {
    color: #667eea;
    margin-bottom: 10px;
}

.popup .roud, .popup .wiki, .popup .fb, .popup .youtube, .popup .more {
    margin: 8px 0;
    padding: 5px 0;
}

.popup .roud strong, .popup .wiki strong, .popup .fb strong, .popup .youtube strong, .popup .more strong {
    width: 75px;
    display: inline-block;
    color: #2c3e50;
}

.popup .favorite {
    margin: 15px 0;
    text-align: center;
}

.favorite-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.favorite-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Responsive Design */
@media only screen and (max-width: 768px) {
    #modern-menu.menu-open {
        width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
    }
    
    #modern-menu.menu-collapsed {
        width: 50px;
        height: 50px;
    }

    #modern-menu.menu-collapsed .menu-header {
        width: 50px;
        height: 50px;
        padding: 8px;
    }
    
    .quick-buttons {
        grid-template-columns: 1fr;
    }
    
    .year-range {
        flex-direction: column;
        gap: 8px;
    }
    
    .year-input {
        text-align: center;
    }

    .panorama-options {
        flex-direction: column;
        gap: 8px;
    }
}

@media only screen and (max-width: 600px) {
    #modern-menu.menu-open {
        top: 10px;
        left: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }
    
    #modern-menu.menu-collapsed {
        top: 10px;
        left: 10px;
        width: 50px;
        height: 50px;
    }

    #modern-menu.menu-collapsed .menu-header {
        width: 50px;
        height: 50px;
        padding: 5px;
    }
    
    .menu-header {
        padding: 15px;
    }
    
    .menu-content {
        padding: 15px;
    }
    
    .popup {
        padding-left: 0;
        width: 90vw;
    }
    
    .popup .parent {
        padding-left: 70px;
        margin-bottom: 15px;
    }
    
    .popup .title {
        text-indent: 50px;
    }
    
    .popup hr {
        position: relative;
    }
}

/* Scrollbar Styling */
.menu-content::-webkit-scrollbar {
    width: 6px;
}

.menu-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.menu-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.menu-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Google Maps Overrides */
.gm-style-iw-c {
    overflow: visible !important;
}

button.gm-ui-hover-effect {
    width: 40px !important;
    height: 40px !important;
}

button.gm-ui-hover-effect img {
    width: 20px !important;
    height: 20px !important;
}

/* Animation Classes */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-content > * {
    animation: fadeIn 0.3s ease-out;
}

.menu-content > *:nth-child(1) { animation-delay: 0.1s; }
.menu-content > *:nth-child(2) { animation-delay: 0.2s; }
.menu-content > *:nth-child(3) { animation-delay: 0.3s; }
.menu-content > *:nth-child(4) { animation-delay: 0.4s; }
.menu-content > *:nth-child(5) { animation-delay: 0.5s; }
