
/* ===== Masjid Map Container ===== */
.masjid-map-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== Prayer Times Panel ===== */
.prayer-times-panel {
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e2e8f0;
}

.prayer-times-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.prayer-times-header h3 {
    margin: 0;
    color: #1e3a5f;
    font-size: 1.2rem;
    font-weight: 800;
}

.location-info {
    font-size: 14px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.prayer-times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.prayer-time-item {
    background: #f8fafc;
    padding: 15px 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.prayer-time-item:hover {
    border-color: #3b7cb5;
    transform: translateY(-3px);
    background: #fff;
    box-shadow: 0 8px 20px rgba(30,58,95,0.08);
}

.prayer-time-item.active {
    background: linear-gradient(135deg, #1e3a5f 0%, #3b7cb5 100%);
    color: #ffffff;
    border-color: #1e3a5f;
    box-shadow: 0 8px 20px rgba(30,58,95,0.2);
}

.prayer-name {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prayer-time-item.active .prayer-name {
    color: rgba(255,255,255,0.9);
}

.prayer-time {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e3a5f;
}

.prayer-time-item.active .prayer-time {
    color: #ffffff;
}

/* ===== Qibla Direction Panel ===== */
.qibla-panel {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #ffffff;
    padding: 30px;
    border-radius: 24px;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(30,58,95,0.3);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qibla-panel h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
}

.qibla-compass-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 15px;
}

.qibla-compass {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 4px solid rgba(255,255,255,0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qibla-arrow {
    position: absolute;
    width: 4px;
    height: 80px;
    background: #ffffff;
    transform-origin: bottom center;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.qibla-arrow::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 15px solid #ffffff;
}

.qibla-direction {
    font-size: 24px;
    font-weight: 700;
    margin-top: 10px;
}

.qibla-distance {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

/* ===== Map Container ===== */
.map-container {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 20px;
}

#masjidMap {
    width: 100%;
    height: 100%;
}

/* Leaflet map styling */
.leaflet-container {
    border-radius: 10px;
}

/* Header bar: today's times + Qibla in one row */
.masjid-header-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px 24px;
    align-items: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(30,58,95,0.25);
}
.masjid-header-left, .masjid-header-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.masjid-header-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}
.masjid-header-left #masjidHeaderTimes {
    font-weight: 700;
    font-size: 0.95rem;
}
.masjid-header-next {
    font-size: 0.85rem;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}
.masjid-header-right #masjidHeaderQibla {
    font-weight: 800;
    font-size: 1.1rem;
}
.masjid-header-settings {
    grid-column: 1 / -1;
    font-size: 11px;
    opacity: 0.85;
}
.masjid-header-settings a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}
.masjid-header-settings a:hover {
    text-decoration: underline;
}
@media (max-width: 768px) {
    .masjid-header-bar {
        grid-template-columns: 1fr;
    }
}

/* ===== Controls Panel ===== */
.controls-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.control-group select,
.control-group input {
    padding: 6px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #007bff;
}

.btn-primary {
    padding: 8px 20px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* ===== Nearest Masjid Card ===== */
.nearest-masjid-card {
    background: linear-gradient(135deg, #3b7cb5 0%, #1e3a5f 100%);
    color: #ffffff;
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(30,58,95,0.2);
}

.nearest-masjid-card h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nearest-masjid-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.nearest-masjid-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.nearest-masjid-info-item i {
    font-size: 16px;
}

.nearest-masjid-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.nearest-masjid-btn {
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nearest-masjid-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

/* ===== Masjid List ===== */
.masjid-list-container {
    margin-top: 20px;
}

.masjid-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 15px;
}

.masjid-list-header h2 {
    margin: 0;
    color: #1e3a5f;
    font-size: 1.4rem;
    font-weight: 800;
}

.masjid-search {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 250px;
}

.masjid-search input {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
}

.masjid-search input:focus {
    outline: none;
    border-color: #007bff;
}

.masjid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.masjid-card {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.masjid-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.masjid-card.nearest {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.masjid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.masjid-name {
    font-size: 18px;
    font-weight: 700;
    color: #004080;
    margin-bottom: 5px;
}

.masjid-distance {
    font-size: 12px;
    color: #28a745;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.masjid-badge {
    padding: 4px 10px;
    background: #ff6b6b;
    color: #ffffff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.masjid-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.masjid-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.masjid-info-item i {
    color: #007bff;
    width: 16px;
}

.masjid-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.masjid-action-btn {
    flex: 1;
    padding: 10px 16px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
}

.masjid-action-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.masjid-action-btn.secondary {
    background: #6c757d;
}

.masjid-action-btn.secondary:hover {
    background: #545b62;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    display: none;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #666;
    font-size: 14px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .masjid-map-container {
        padding: 15px;
    }
    
    .prayer-times-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .prayer-time-item {
        padding: 6px 4px;
    }
    
    .prayer-name {
        font-size: 10px;
        margin-bottom: 3px;
    }
    
    .prayer-time {
        font-size: 12px;
    }
    
    .map-container {
        height: 400px;
    }
    
    .masjid-list {
        grid-template-columns: 1fr;
    }
    
    .masjid-list-header {
        flex-direction: column;
    }
    
    .masjid-search {
        width: 100%;
    }
    
    .qibla-compass-container {
        width: 150px;
        height: 150px;
    }
    
    .controls-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        width: 100%;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #004080 0%, #0066cc 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.modal-header .close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.modal-header .close:hover,
.modal-header .close:focus {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Masjid submenu views: directory vs driving directions */
.masjid-page-heading {
    margin: 0 0 18px;
    font-size: 1.35rem;
    font-weight: 800;
    color: #1e3a5f;
}
.masjid-page-heading small {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
}
body.masjid-view-directory .masjid-directions-only,
body.masjid-view-directory .masjid-general-only {
    display: none !important;
}
body.masjid-view-directions .masjid-directory-only,
body.masjid-view-directions .masjid-general-only {
    display: none !important;
}
body.masjid-view-directions .map-container {
    min-height: 420px;
}
body.masjid-view-directions #masjidMap {
    min-height: 420px;
}
body.masjid-view-directory .masjid-list-container {
    margin-top: 0;
}
